FEATURE: Add "Reset Bump Date" action to topic admin wrench (#6246)

This commit is contained in:
Gerhard Schlager
2018-08-10 02:51:03 +02:00
committed by Sam
parent 6db623ef6b
commit b9072e8292
12 changed files with 113 additions and 1 deletions

View File

@ -33,7 +33,8 @@ class TopicsController < ApplicationController
:move_to_inbox,
:convert_topic,
:bookmark,
:publish
:publish,
:reset_bump_date
]
before_action :consider_user_for_promotion, only: :show
@ -720,6 +721,17 @@ class TopicsController < ApplicationController
render_json_error(ex)
end
def reset_bump_date
params.require(:id)
guardian.ensure_can_update_bumped_at!
topic = Topic.find_by(id: params[:id])
raise Discourse::NotFound.new unless topic
topic.reset_bumped_at
render body: nil
end
private
def topic_params