From 98a2bb8be2e47d26b6306dcbe82c82a1f17f0813 Mon Sep 17 00:00:00 2001 From: Claire Date: Wed, 20 Mar 2024 18:02:09 +0100 Subject: [PATCH] Fix issue with severed relationships notifications (#29668) --- app/models/account_relationship_severance_event.rb | 2 +- app/models/notification.rb | 2 +- app/serializers/rest/notification_serializer.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/account_relationship_severance_event.rb b/app/models/account_relationship_severance_event.rb index 32b185e3af..e621b54758 100644 --- a/app/models/account_relationship_severance_event.rb +++ b/app/models/account_relationship_severance_event.rb @@ -16,7 +16,7 @@ class AccountRelationshipSeveranceEvent < ApplicationRecord belongs_to :account belongs_to :relationship_severance_event - delegate :severed_relationships, :type, :target_name, :purged, to: :relationship_severance_event, prefix: false + delegate :severed_relationships, :type, :target_name, :purged?, to: :relationship_severance_event, prefix: false before_create :set_relationships_count! diff --git a/app/models/notification.rb b/app/models/notification.rb index 8ee7e77258..b2376c78a3 100644 --- a/app/models/notification.rb +++ b/app/models/notification.rb @@ -89,7 +89,7 @@ class Notification < ApplicationRecord belongs_to :favourite, inverse_of: :notification belongs_to :poll, inverse_of: false belongs_to :report, inverse_of: false - belongs_to :relationship_severance_event, inverse_of: false + belongs_to :account_relationship_severance_event, inverse_of: false end validates :type, inclusion: { in: TYPES } diff --git a/app/serializers/rest/notification_serializer.rb b/app/serializers/rest/notification_serializer.rb index d7b88b7c37..36a0adfec4 100644 --- a/app/serializers/rest/notification_serializer.rb +++ b/app/serializers/rest/notification_serializer.rb @@ -6,7 +6,7 @@ class REST::NotificationSerializer < ActiveModel::Serializer belongs_to :from_account, key: :account, serializer: REST::AccountSerializer belongs_to :target_status, key: :status, if: :status_type?, serializer: REST::StatusSerializer belongs_to :report, if: :report_type?, serializer: REST::ReportSerializer - belongs_to :relationship_severance_event, key: :event, if: :relationship_severance_event?, serializer: REST::AccountRelationshipSeveranceEventSerializer + belongs_to :account_relationship_severance_event, key: :event, if: :relationship_severance_event?, serializer: REST::AccountRelationshipSeveranceEventSerializer def id object.id.to_s