From 45c7ee39b3d45159de382e8596110af04ee1ed8c Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Tue, 22 Nov 2016 17:32:51 +0100 Subject: Remove unneeded indices, improve error handling in background workers, don't needlessly reload reblogged status, send Devise e-mails asynchronously --- app/models/notification.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'app/models/notification.rb') 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) } -- cgit