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
parent 10bcbf15af
commit 8787077462
3 changed files with 28 additions and 2 deletions

View file

@ -106,6 +106,7 @@ class Notification < ApplicationRecord
validates :type, inclusion: { in: TYPES }
scope :without_suspended, -> { joins(:from_account).merge(Account.without_suspended) }
scope :by_group_key, ->(group_key) { group_key&.start_with?('ungrouped-') ? where(id: group_key.delete_prefix('ungrouped-')) : where(group_key: group_key) }
def type
@type ||= (super || LEGACY_TYPE_CLASS_MAP[activity_type]).to_sym