mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
FEATURE: Allow admin to change timestamp of topic.
This commit is contained in:
@ -24,6 +24,7 @@ class TopicsController < ApplicationController
|
||||
:bulk,
|
||||
:reset_new,
|
||||
:change_post_owners,
|
||||
:change_timestamps,
|
||||
:bookmark,
|
||||
:unsubscribe]
|
||||
|
||||
@ -375,6 +376,22 @@ class TopicsController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
def change_timestamps
|
||||
params.require(:topic_id)
|
||||
params.require(:timestamp)
|
||||
|
||||
guardian.ensure_can_change_post_owner!
|
||||
|
||||
begin
|
||||
PostTimestampChanger.new( topic_id: params[:topic_id].to_i,
|
||||
timestamp: params[:timestamp].to_i ).change!
|
||||
|
||||
render json: success_json
|
||||
rescue ActiveRecord::RecordInvalid
|
||||
render json: failed_json, status: 422
|
||||
end
|
||||
end
|
||||
|
||||
def clear_pin
|
||||
topic = Topic.find_by(id: params[:topic_id].to_i)
|
||||
guardian.ensure_can_see!(topic)
|
||||
|
Reference in New Issue
Block a user