Compare commits

...

2 Commits

Author SHA1 Message Date
Matt Jankowski
cf06ea7200
Merge 69c051bc92 into c442589593 2025-07-10 08:06:41 +00:00
Matt Jankowski
69c051bc92 Use excluding in simple applications 2025-07-03 18:29:53 -04:00
5 changed files with 5 additions and 5 deletions

View File

@ -19,7 +19,7 @@ class AccountSuggestions::Source
.where.not(follow_requests_sql, id: account.id)
.not_excluded_by_account(account)
.not_domain_blocked_by_account(account)
.where.not(id: account.id)
.excluding(account)
.where.not(follow_recommendation_mutes_sql, id: account.id)
end

View File

@ -198,7 +198,7 @@ class ActivityPub::ProcessAccountService < BaseService
end
def process_duplicate_accounts!
return unless Account.where(uri: @account.uri).where.not(id: @account.id).exists?
return unless Account.where(uri: @account.uri).excluding(@account).exists?
AccountMergingWorker.perform_async(@account.id)
end

View File

@ -7,7 +7,7 @@ class UniqueUsernameValidator < ActiveModel::Validator
return if account.username.blank?
scope = Account.with_username(account.username).with_domain(account.domain)
scope = scope.where.not(id: account.id) if account.persisted?
scope = scope.excluding(account) if account.persisted?
account.errors.add(:username, :taken) if scope.exists?
end

View File

@ -10,7 +10,7 @@ class AccountMergingWorker
return true if account.nil? || account.local?
Account.where(uri: account.uri).where.not(id: account.id).find_each do |duplicate|
Account.where(uri: account.uri).excluding(account).find_each do |duplicate|
account.merge_with!(duplicate)
duplicate.destroy
end

View File

@ -22,7 +22,7 @@ class BackupWorker
BackupService.new.call(backup)
user.backups.where.not(id: backup.id).destroy_all
user.backups.excluding(backup).destroy_all
UserMailer.backup_ready(user, backup).deliver_later
end
end