mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 23:36:11 +08:00
FEATURE: Let staff add custom post notices. (#7377)
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user