FEATURE: Create logs for Group Moderator changes (#10271)

This commit is contained in:
jbrw
2020-07-21 14:29:02 -04:00
committed by GitHub
parent 549c552402
commit 0ed784b4fc
10 changed files with 135 additions and 2 deletions

View File

@ -621,6 +621,12 @@ class Topic < ActiveRecord::Base
TopicStatusUpdater.new(self, user).update!(status, enabled, opts)
DiscourseEvent.trigger(:topic_status_updated, self, status, enabled)
if status == 'closed'
StaffActionLogger.new(user).log_topic_closed(self, closed: enabled)
elsif status == 'archived'
StaffActionLogger.new(user).log_topic_archived(self, archived: enabled)
end
if enabled && private_message? && status.to_s["closed"]
group_ids = user.groups.pluck(:id)
if group_ids.present?