Add emoji_reactioned_by_slim api (not work)

This commit is contained in:
KMY 2023-02-27 08:45:11 +09:00
parent a1485f242d
commit 9ad51e001e
8 changed files with 98 additions and 3 deletions

View file

@ -29,6 +29,8 @@
# ordered_media_attachment_ids :bigint(8) is an Array
#
require 'ostruct'
class Status < ApplicationRecord
before_destroy :unlink_from_conversations!
@ -312,6 +314,11 @@ class Status < ApplicationRecord
end
end
def generate_emoji_reactions_grouped_by_account
# TODO for serializer
EmojiReaction.where(status_id: id).group_by(&:account)
end
def trendable?
if attributes['trendable'].nil?
account.trendable?

View file

@ -0,0 +1,14 @@
class StatusEmojiReactionsGroupedByAccountObject
def initialize(account, emoji_reactions)
@account = account
@emoji_reactions = emoji_reactions
end
def read_attribute_for_serialization(_)
REST::EmojiReactedBySlimSerializer
end
def model_name
'EmojiReaction'
end
end