about summary refs log tree commit diff
path: root/app/models/notification.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/notification.rb')
-rw-r--r--app/models/notification.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/app/models/notification.rb b/app/models/notification.rb
index 419f31230..c0537397c 100644
--- a/app/models/notification.rb
+++ b/app/models/notification.rb
@@ -11,6 +11,8 @@ class Notification < ApplicationRecord
   belongs_to :follow,    foreign_type: 'Follow',    foreign_key: 'activity_id'
   belongs_to :favourite, foreign_type: 'Favourite', foreign_key: 'activity_id'
 
+  validates :account_id, uniqueness: { scope: [:activity_type, :activity_id] }
+
   STATUS_INCLUDES = [:account, :stream_entry, :media_attachments, :tags, mentions: :account, reblog: [:stream_entry, :account, :media_attachments, :tags, mentions: :account]].freeze
 
   scope :with_includes, -> { includes(status: STATUS_INCLUDES, mention: [status: STATUS_INCLUDES], favourite: [:account, status: STATUS_INCLUDES], follow: :account) }