Fix 500 error in GET /api/v2_alpha/notifications when there are no notifications to return (#31746)

This commit is contained in:
Claire authored and GitHub committed 2024-09-04 12:54:15 +00:00
1 parent ee55d20fd5
commit 1fcffa573c
2 files changed
+15

No files matched your search

@@ -77,6 +77,8 @@ class Api::V2Alpha::NotificationsController < Api::BaseController
end
def load_grouped_notifications
return [] if @notifications.empty?
MastodonOTELTracer.in_span('Api::V2Alpha::NotificationsController#load_grouped_notifications') do
NotificationGroup.from_notifications(@notifications, pagination_range: (@notifications.last.id)..(@notifications.first.id), grouped_types: params[:grouped_types])
end