mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 23:36:11 +08:00
FEATURE: Log staff actions for Category changes.
This commit is contained in:
@ -64,6 +64,7 @@ describe CategoriesController do
|
||||
expect(category.slug).to eq("hello-cat")
|
||||
expect(category.color).to eq("ff0")
|
||||
expect(category.auto_close_hours).to eq(72)
|
||||
expect(UserHistory.count).to eq(1)
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -90,6 +91,7 @@ describe CategoriesController do
|
||||
it "deletes the record" do
|
||||
Guardian.any_instance.expects(:can_delete_category?).returns(true)
|
||||
expect { xhr :delete, :destroy, id: @category.slug}.to change(Category, :count).by(-1)
|
||||
expect(UserHistory.count).to eq(1)
|
||||
end
|
||||
end
|
||||
|
||||
@ -215,6 +217,17 @@ describe CategoriesController do
|
||||
expect(@category.auto_close_hours).to eq(72)
|
||||
expect(@category.custom_fields).to eq({"dancing" => "frogs"})
|
||||
end
|
||||
|
||||
it 'logs the changes correctly' do
|
||||
xhr :put , :update, id: @category.id, name: 'new name',
|
||||
color: @category.color, text_color: @category.text_color,
|
||||
slug: @category.slug,
|
||||
permissions: {
|
||||
"everyone" => CategoryGroup.permission_types[:create_post]
|
||||
}
|
||||
|
||||
expect(UserHistory.count).to eq(2)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user