diff --git a/app/controllers/api/v1/statuses/reactions_controller.rb b/app/controllers/api/v1/statuses/reactions_controller.rb index eb4b6f3411af53..e6cee38fe0fc36 100644 --- a/app/controllers/api/v1/statuses/reactions_controller.rb +++ b/app/controllers/api/v1/statuses/reactions_controller.rb @@ -41,8 +41,20 @@ def set_reactions end def ordered_reactions - StatusReaction.where(status: @status) - .group(:status_id, :id, :account_id, :name, :custom_emoji_id) + filtered_reactions.group(:status_id, :id, :account_id, :name, :custom_emoji_id) + end + + def filtered_reactions + initial_reactions = StatusReaction.where(status: @status) + if filtered? + initial_reactions.where(name: params[:emoji]) + else + initial_reactions + end + end + + def filtered? + params[:emoji].present? end def value_for_reaction_me_column(account) @@ -91,6 +103,6 @@ def records_continue? end def pagination_params(core_params) - params_slice(:limit).merge(core_params) + params_slice(:limit, :emoji).merge(core_params) end end