UX: when admin is deleted, make it clear in staff action logs when records belong to a deleted user and show their username in the details

This commit is contained in:
Neil Lalonde
2018-10-02 13:46:43 -04:00
parent 98aaad6675
commit dc1e7bb645
4 changed files with 45 additions and 3 deletions

View File

@@ -360,6 +360,28 @@ describe UserDestroyer do
}.to change { User.count }.by(-1)
end
end
context 'user has staff action logs' do
before do
logger = StaffActionLogger.new(user)
logger.log_site_setting_change(
'site_description',
'Our friendly community',
'My favourite community'
)
end
it "should keep the staff action log and add the username" do
username = user.username
log = UserHistory.staff_action_records(
Discourse.system_user,
acting_user: username
).to_a[0]
UserDestroyer.new(admin).destroy(user, delete_posts: true)
log.reload
expect(log.details).to include(username)
end
end
end
end