FIX: Unassign user titles when a badge is deleted (#9573)

This commit is contained in:
Kane York
2020-05-02 18:02:28 -07:00
committed by GitHub
parent 0e4db91870
commit 784bf2a173
4 changed files with 99 additions and 34 deletions

View File

@@ -129,9 +129,12 @@ class Admin::BadgesController < Admin::AdminController
end
def destroy
badge = find_badge
StaffActionLogger.new(current_user).log_badge_deletion(badge)
badge.destroy
Badge.transaction do
badge = find_badge
StaffActionLogger.new(current_user).log_badge_deletion(badge)
badge.clear_user_titles!
badge.destroy!
end
render body: nil
end