mirror of
https://github.com/discourse/discourse.git
synced 2025-05-30 07:11:34 +08:00
DEV: add API endpoint to destroy_timings only of last post
Previously API only allowed you to nuke all timings from a topic, new API is less punishing and allows you just to remove 1 post.
This commit is contained in:
@ -250,7 +250,12 @@ class TopicsController < ApplicationController
|
||||
end
|
||||
|
||||
def destroy_timings
|
||||
PostTiming.destroy_for(current_user.id, [params[:topic_id].to_i])
|
||||
if params[:last].to_s == "1"
|
||||
PostTiming.destroy_last_for(current_user, params[:topic_id])
|
||||
else
|
||||
PostTiming.destroy_for(current_user.id, [params[:topic_id].to_i])
|
||||
end
|
||||
|
||||
render body: nil
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user