mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 03:09:00 +08:00
FIX: Allow queued posts from deleted users to be rejected
This commit is contained in:
parent
bb2005d466
commit
1bce97a596
|
@ -566,8 +566,8 @@ class StaffActionLogger
|
|||
|
||||
topic = reviewable.topic || Topic.with_deleted.find_by(id: reviewable.topic_id)
|
||||
topic_title = topic&.title || I18n.t('staff_action_logs.not_found')
|
||||
username = reviewable.created_by.username || I18n.t('staff_action_logs.unknown')
|
||||
name = reviewable.created_by.name || I18n.t('staff_action_logs.unknown')
|
||||
username = reviewable.created_by&.username || I18n.t('staff_action_logs.unknown')
|
||||
name = reviewable.created_by&.name || I18n.t('staff_action_logs.unknown')
|
||||
|
||||
details = [
|
||||
"created_at: #{reviewable.created_at}",
|
||||
|
|
|
@ -505,5 +505,16 @@ describe StaffActionLogger do
|
|||
expect(user_history.action).to eq(UserHistory.actions[:post_rejected])
|
||||
expect(user_history.details).to include(reviewable.payload['raw'])
|
||||
end
|
||||
|
||||
it "works if the user was destroyed" do
|
||||
reviewable.created_by.destroy
|
||||
reviewable.reload
|
||||
|
||||
expect { log_post_rejected }.to change { UserHistory.count }.by(1)
|
||||
user_history = UserHistory.last
|
||||
expect(user_history.action).to eq(UserHistory.actions[:post_rejected])
|
||||
expect(user_history.details).to include(reviewable.payload['raw'])
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user