From 89a8c21f802e97c6929365c5c2d6246b0c58e6af Mon Sep 17 00:00:00 2001 From: fef Date: Tue, 29 Nov 2022 08:15:52 +0000 Subject: [PATCH] cleanup backend emoji reaction code --- app/controllers/api/v1/statuses/reactions_controller.rb | 4 ++-- app/serializers/activitypub/emoji_reaction_serializer.rb | 4 +--- app/services/{status_reaction_service.rb => react_service.rb} | 2 +- .../{status_unreaction_service.rb => unreact_service.rb} | 2 +- 4 files changed, 5 insertions(+), 7 deletions(-) rename app/services/{status_reaction_service.rb => react_service.rb} (95%) rename app/services/{status_unreaction_service.rb => unreact_service.rb} (92%) diff --git a/app/controllers/api/v1/statuses/reactions_controller.rb b/app/controllers/api/v1/statuses/reactions_controller.rb index f7dc2f99ce..db43346def 100644 --- a/app/controllers/api/v1/statuses/reactions_controller.rb +++ b/app/controllers/api/v1/statuses/reactions_controller.rb @@ -8,12 +8,12 @@ class Api::V1::Statuses::ReactionsController < Api::BaseController before_action :set_reaction, except: :update def update - StatusReactionService.new.call(current_account, @status, params[:id]) + ReactService.new.call(current_account, @status, params[:id]) render_empty end def destroy - StatusUnreactionService.new.call(current_account, @status) + UnreactService.new.call(current_account, @status) render_empty end diff --git a/app/serializers/activitypub/emoji_reaction_serializer.rb b/app/serializers/activitypub/emoji_reaction_serializer.rb index b4111150a4..50f3efa3cb 100644 --- a/app/serializers/activitypub/emoji_reaction_serializer.rb +++ b/app/serializers/activitypub/emoji_reaction_serializer.rb @@ -30,7 +30,5 @@ class ActivityPub::EmojiReactionSerializer < ActivityPub::Serializer end end - def reaction - content - end + alias reaction content end diff --git a/app/services/status_reaction_service.rb b/app/services/react_service.rb similarity index 95% rename from app/services/status_reaction_service.rb rename to app/services/react_service.rb index 9451690dd1..773dd3fd6c 100644 --- a/app/services/status_reaction_service.rb +++ b/app/services/react_service.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class StatusReactionService < BaseService +class ReactService < BaseService include Authorization include Payloadable diff --git a/app/services/status_unreaction_service.rb b/app/services/unreact_service.rb similarity index 92% rename from app/services/status_unreaction_service.rb rename to app/services/unreact_service.rb index 13c3c428db..ebc270383c 100644 --- a/app/services/status_unreaction_service.rb +++ b/app/services/unreact_service.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class StatusUnreactionService < BaseService +class UnreactService < BaseService include Payloadable def call(account, status)