mirror of
https://github.com/discourse/discourse.git
synced 2025-06-06 11:36:01 +08:00
DEV: Add post_id parameter to reset_bump_date route (#25372)
This would allow a theme component (or an API call) to reset the bump date of a topic to a given post's created_at date. I picked `post_id` as the parameter here because it provides a bit of extra protection against accidentally resetting the bump date to a date that doesn't make sense.
This commit is contained in:
@ -1151,12 +1151,14 @@ class TopicsController < ApplicationController
|
||||
|
||||
def reset_bump_date
|
||||
params.require(:id)
|
||||
params.permit(:post_id)
|
||||
|
||||
guardian.ensure_can_update_bumped_at!
|
||||
|
||||
topic = Topic.find_by(id: params[:id])
|
||||
raise Discourse::NotFound.new unless topic
|
||||
|
||||
topic.reset_bumped_at
|
||||
topic.reset_bumped_at(params[:post_id])
|
||||
render body: nil
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user