]> cat aescling's git repositories - mastodon.git/commitdiff
Merge branch 'fix/cache_blocking' of git://github.com/pixiv/mastodon into pixiv-fix...
authorEugen Rochko <eugen@zeonfederated.com>
Mon, 17 Apr 2017 23:09:57 +0000 (01:09 +0200)
committerEugen Rochko <eugen@zeonfederated.com>
Mon, 17 Apr 2017 23:09:57 +0000 (01:09 +0200)
1  2 
app/models/mute.rb
app/models/status.rb

index 7987ed00754929968410e6b2ff2f20c007ad9c2a,875d030e97a81fa1d9f798b150886c952e1f896d..0cf17be4f99faeaf30d65a80d805998361126ffd
@@@ -3,8 -3,16 +3,15 @@@
  class Mute < ApplicationRecord
    include Paginable
  
 -  belongs_to :account
 -  belongs_to :target_account, class_name: 'Account'
 +  belongs_to :account, required: true
 +  belongs_to :target_account, class_name: 'Account', required: true
  
 -  validates :account, :target_account, presence: true
    validates :account_id, uniqueness: { scope: :target_account_id }
+   after_create :remove_blocking_cache
+   after_destroy :remove_blocking_cache
+   def remove_blocking_cache
+     Rails.cache.delete("blocked_account_ids:#{account_id}")
+   end
  end
Simple merge