diff --git a/app/models/block.rb b/app/models/block.rb index 662cc1ac20..a5e8ad7ffa 100644 --- a/app/models/block.rb +++ b/app/models/block.rb @@ -25,7 +25,7 @@ class Block < ApplicationRecord false # Force uri_for to use uri attribute end - before_validation :set_uri, only: :create + before_validation :set_uri, on: :create after_commit :invalidate_blocking_cache after_commit :invalidate_follow_recommendations_cache diff --git a/app/models/collection_item.rb b/app/models/collection_item.rb index 189cc29e69..cc77583674 100644 --- a/app/models/collection_item.rb +++ b/app/models/collection_item.rb @@ -36,7 +36,7 @@ class CollectionItem < ApplicationRecord validates :uri, presence: true, if: :remote_item_with_remote_account? before_validation :set_position, on: :create - before_validation :set_activity_uri, only: :create, if: :local_item_with_remote_account? + before_validation :set_activity_uri, on: :create, if: :local_item_with_remote_account? scope :ordered, -> { order(position: :asc) } scope :with_accounts, -> { includes(account: [:account_stat, :user]) } diff --git a/app/models/follow.rb b/app/models/follow.rb index c8930c2f86..e8da0077c9 100644 --- a/app/models/follow.rb +++ b/app/models/follow.rb @@ -42,7 +42,7 @@ class Follow < ApplicationRecord destroy! end - before_validation :set_uri, only: :create + before_validation :set_uri, on: :create after_create :increment_cache_counters after_destroy :remove_endorsements after_destroy :decrement_cache_counters diff --git a/app/models/follow_request.rb b/app/models/follow_request.rb index 906de95db2..5d8b5f9c08 100644 --- a/app/models/follow_request.rb +++ b/app/models/follow_request.rb @@ -51,7 +51,7 @@ class FollowRequest < ApplicationRecord false # Force uri_for to use uri attribute end - before_validation :set_uri, only: :create + before_validation :set_uri, on: :create after_commit :invalidate_follow_recommendations_cache private diff --git a/app/models/quote.rb b/app/models/quote.rb index 44c3599a7b..c49a66c278 100644 --- a/app/models/quote.rb +++ b/app/models/quote.rb @@ -35,7 +35,7 @@ class Quote < ApplicationRecord belongs_to :quoted_account, class_name: 'Account', optional: true before_validation :set_accounts - before_validation :set_activity_uri, only: :create, if: -> { account.local? && quoted_account&.remote? } + before_validation :set_activity_uri, on: :create, if: -> { account.local? && quoted_account&.remote? } validates :activity_uri, presence: true, if: -> { account.local? && quoted_account&.remote? } validates :approval_uri, absence: true, if: -> { quoted_account&.local? } validate :validate_visibility diff --git a/app/models/report.rb b/app/models/report.rb index 282a1f7570..117005c862 100644 --- a/app/models/report.rb +++ b/app/models/report.rb @@ -68,7 +68,7 @@ class Report < ApplicationRecord violation: 2_000, } - before_validation :set_uri, only: :create + before_validation :set_uri, on: :create after_create_commit :trigger_create_webhooks after_update_commit :trigger_update_webhooks