Change: 絵文字リアクションの通知のグループ化で、アカウントを絵文字の種類ごとに表示 (#796)

* Change: 絵文字リアクションの通知のグループ化で、アカウントを絵文字の種類ごとに表示

* Fix lint

* アカウントの一括取得数を制限

* ストリーミング対応

* Fix

* Fix

* Fix

* Fix some problems

* Fix
This commit is contained in:
KMY(雪あすか) 2024-08-17 08:16:27 +09:00 committed by GitHub
parent 5dec110dec
commit f14c2d3ada
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 258 additions and 7 deletions

View file

@ -30,6 +30,10 @@ class REST::NotificationGroupSerializer < ActiveModel::Serializer
object.type == :'admin.report'
end
def emoji_reaction_type?
object.type == :emoji_reaction
end
def relationship_severance_event?
object.type == :severed_relationships
end
@ -56,4 +60,15 @@ class REST::NotificationGroupSerializer < ActiveModel::Serializer
def paginated?
!instance_options[:group_metadata].nil?
end
class NotificationEmojiReactionGroupSerializer < ActiveModel::Serializer
has_one :emoji_reaction, serializer: REST::NotifyEmojiReactionSerializer
attribute :sample_account_ids
def sample_account_ids
object.sample_accounts.pluck(:id).map(&:to_s)
end
end
has_many :emoji_reaction_groups, each_serializer: NotificationEmojiReactionGroupSerializer, if: :emoji_reaction_type?
end

View file

@ -1,6 +1,7 @@
# frozen_string_literal: true
class REST::NotifyEmojiReactionSerializer < ActiveModel::Serializer
# Please update app/javascript/api_types/notification.ts when making changes to the attributes
include RoutingHelper
attributes :name