mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 10:50:26 -06:00
FEATURE: Log when a group is deleted. (#11706)
We include the group "name" and "granted_trust_level" attributes.
This commit is contained in:
parent
bd7cbcd8f8
commit
1ad378f5c5
@ -80,6 +80,10 @@ class Admin::GroupsController < Admin::AdminController
|
||||
if group.automatic
|
||||
can_not_modify_automatic
|
||||
else
|
||||
details = { name: group.name }
|
||||
details[:grant_trust_level] = group.grant_trust_level if group.grant_trust_level
|
||||
|
||||
StaffActionLogger.new(current_user).log_custom('delete_group', details)
|
||||
group.destroy!
|
||||
render json: success_json
|
||||
end
|
||||
|
@ -4437,6 +4437,7 @@ en:
|
||||
topic_unarchived: "topic unarchived"
|
||||
post_staff_note_create: "add staff note"
|
||||
post_staff_note_destroy: "destroy staff note"
|
||||
delete_group: "delete group"
|
||||
screened_emails:
|
||||
title: "Screened Emails"
|
||||
description: "When someone tries to create a new account, the following email addresses will be checked and the registration will be blocked, or some other action performed."
|
||||
|
@ -235,6 +235,27 @@ RSpec.describe Admin::GroupsController do
|
||||
expect(response.status).to eq(404)
|
||||
end
|
||||
|
||||
it 'logs when a group is destroyed' do
|
||||
delete "/admin/groups/#{group.id}.json"
|
||||
|
||||
history = UserHistory.where(acting_user: admin).last
|
||||
|
||||
expect(history).to be_present
|
||||
expect(history.details).to include("name: #{group.name}")
|
||||
end
|
||||
|
||||
it 'logs the grant_trust_level attribute' do
|
||||
trust_level = TrustLevel[4]
|
||||
group.update!(grant_trust_level: trust_level)
|
||||
delete "/admin/groups/#{group.id}.json"
|
||||
|
||||
history = UserHistory.where(acting_user: admin).last
|
||||
|
||||
expect(history).to be_present
|
||||
expect(history.details).to include("grant_trust_level: #{trust_level}")
|
||||
expect(history.details).to include("name: #{group.name}")
|
||||
end
|
||||
|
||||
describe 'when group is automatic' do
|
||||
it "returns the right response" do
|
||||
group.update!(automatic: true)
|
||||
|
Loading…
Reference in New Issue
Block a user