FEATURE: Warn a user when they have few likes remaining

This commit is contained in:
Robin Ward
2016-03-18 11:17:51 -04:00
parent 1fba835d4f
commit 5d4ee2ca1d
9 changed files with 75 additions and 17 deletions

View File

@ -21,6 +21,12 @@ class PostActionsController < ApplicationController
else
# We need to reload or otherwise we are showing the old values on the front end
@post.reload
if @post_action_type_id == PostActionType.types[:like]
limiter = post_action.post_action_rate_limiter
response.headers['Discourse-Actions-Remaining'] = limiter.remaining.to_s
response.headers['Discourse-Actions-Max'] = limiter.max.to_s
end
render_post_json(@post, _add_raw = false)
end
end