Fix GET /api/v2/notifications/:id and POST /api/v2/notifications/:id/dismiss for ungrouped notifications (#33990)

This commit is contained in:
Claire 2025-02-25 15:37:44 +01:00 committed by GitHub
parent 33643c4c07
commit 20531d1e07
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 31 additions and 2 deletions

View file

@ -7,6 +7,10 @@ module Notification::Groups
GROUPABLE_NOTIFICATION_TYPES = %i(favourite reblog follow).freeze
MAXIMUM_GROUP_SPAN_HOURS = 12
included do
scope :by_group_key, ->(group_key) { group_key&.start_with?('ungrouped-') ? where(id: group_key.delete_prefix('ungrouped-')) : where(group_key: group_key) }
end
def set_group_key!
return if filtered? || GROUPABLE_NOTIFICATION_TYPES.exclude?(type)