about summary refs log tree commit diff
path: root/app/models/notification.rb
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-11-22 17:32:51 +0100
committerEugen Rochko <eugen@zeonfederated.com>2016-11-22 17:32:51 +0100
commit45c7ee39b3d45159de382e8596110af04ee1ed8c (patch)
tree161516b55c190c41c1c2421e0d885960957744f2 /app/models/notification.rb
parent95db6cbe28acc193ff0c898790a6740c4ff3d473 (diff)
Remove unneeded indices, improve error handling in background workers, don't needlessly reload reblogged status, send Devise e-mails asynchronously
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) }