0
0
Fork 0

Change grouped notifications API shape (take 2) (#31214)

This commit is contained in:
Claire 2024-07-31 12:50:13 +02:00 committed by GitHub
parent 288961bbb9
commit 549ab089ee
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 70 additions and 20 deletions

View file

@ -33,7 +33,8 @@ class Api::V2Alpha::NotificationsController < Api::BaseController
'app.notification_grouping.status.unique_count' => statuses.uniq.size
)
render json: @grouped_notifications, each_serializer: REST::NotificationGroupSerializer, relationships: @relationships, group_metadata: @group_metadata
presenter = GroupedNotificationsPresenter.new(@grouped_notifications)
render json: presenter, serializer: REST::DedupNotificationGroupSerializer, relationships: @relationships, group_metadata: @group_metadata
end
end
@ -47,7 +48,8 @@ class Api::V2Alpha::NotificationsController < Api::BaseController
def show
@notification = current_account.notifications.without_suspended.find_by!(group_key: params[:id])
render json: NotificationGroup.from_notification(@notification), serializer: REST::NotificationGroupSerializer
presenter = GroupedNotificationsPresenter.new([NotificationGroup.from_notification(@notification)])
render json: presenter, serializer: REST::DedupNotificationGroupSerializer
end
def clear