2024-07-31 12:50:13 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class REST::DedupNotificationGroupSerializer < ActiveModel::Serializer
|
2024-08-06 14:09:35 +02:00
|
|
|
class PartialAccountSerializer < REST::AccountSerializer
|
|
|
|
# This is a hack to reset ActiveModel::Serializer internals and only expose the attributes
|
|
|
|
# we care about.
|
|
|
|
self._attributes_data = {}
|
|
|
|
self._reflections = []
|
|
|
|
self._links = []
|
|
|
|
|
|
|
|
attributes :id, :acct, :locked, :bot, :url, :avatar, :avatar_static
|
|
|
|
end
|
|
|
|
|
2024-07-31 12:50:13 +02:00
|
|
|
has_many :accounts, serializer: REST::AccountSerializer
|
2024-08-06 14:09:35 +02:00
|
|
|
has_many :partial_accounts, serializer: PartialAccountSerializer, if: :return_partial_accounts?
|
2024-07-31 12:50:13 +02:00
|
|
|
has_many :statuses, serializer: REST::StatusSerializer
|
|
|
|
has_many :notification_groups, serializer: REST::NotificationGroupSerializer
|
2024-08-06 14:09:35 +02:00
|
|
|
|
|
|
|
def return_partial_accounts?
|
|
|
|
instance_options[:expand_accounts] == 'partial_avatars'
|
|
|
|
end
|
2024-07-31 12:50:13 +02:00
|
|
|
end
|