FEATURE: Let staff add custom post notices. (#7377)

This commit is contained in:
Dan Ungureanu
2019-04-19 17:53:58 +03:00
committed by GitHub
parent ba6369edc5
commit 57d1dea8a2
24 changed files with 282 additions and 102 deletions

View File

@ -476,6 +476,22 @@ class PostsController < ApplicationController
render_json_dump(locked: post.locked?)
end
def notice
raise Discourse::NotFound unless guardian.is_staff?
post = find_post_from_params
if params[:notice].present?
post.custom_fields["notice_type"] = Post.notices[:custom]
post.custom_fields["notice_args"] = params[:notice]
post.save_custom_fields
else
post.delete_post_notices
end
render body: nil
end
def bookmark
if params[:bookmarked] == "true"
post = find_post_from_params