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

@ -477,6 +477,8 @@ class PostsController < ApplicationController
post = find_post_from_params
raise Discourse::NotFound unless guardian.can_edit_staff_notes?(post.topic)
previous_notice = post.custom_fields[Post::NOTICE_ARGS]
if params[:notice].present?
post.custom_fields[Post::NOTICE_TYPE] = Post.notices[:custom]
post.custom_fields[Post::NOTICE_ARGS] = PrettyText.cook(params[:notice], features: { onebox: false })
@ -485,6 +487,9 @@ class PostsController < ApplicationController
post.delete_post_notices
end
details = { new_raw_value: params[:notice], old_value: previous_notice }
StaffActionLogger.new(current_user).log_post_staff_note(post, details)
render body: nil
end