Merge remote-tracking branch 'parent/main' into upstream-20240913
This commit is contained in:
commit
fc9d27ff91
392 changed files with 3757 additions and 3233 deletions
|
@ -167,7 +167,7 @@ class AccountStatusesCleanupPolicy < ApplicationRecord
|
|||
end
|
||||
|
||||
def without_media_scope
|
||||
Status.where('NOT EXISTS (SELECT 1 FROM media_attachments media WHERE media.status_id = statuses.id)')
|
||||
Status.where.not(status_media_reference_exists)
|
||||
end
|
||||
|
||||
def without_poll_scope
|
||||
|
@ -186,6 +186,14 @@ class AccountStatusesCleanupPolicy < ApplicationRecord
|
|||
Status.where(account_id: account_id)
|
||||
end
|
||||
|
||||
def status_media_reference_exists
|
||||
MediaAttachment
|
||||
.where(MediaAttachment.arel_table[:status_id].eq Status.arel_table[:id])
|
||||
.select(1)
|
||||
.arel
|
||||
.exists
|
||||
end
|
||||
|
||||
def self_status_reference_exists(model)
|
||||
model
|
||||
.where(model.arel_table[:account_id].eq Status.arel_table[:account_id])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue