mirror of
https://github.com/mastodon/mastodon.git
synced 2025-07-12 15:33:14 +00:00
Compare commits
2 Commits
7b39844de4
...
7173ad9c9f
Author | SHA1 | Date | |
---|---|---|---|
![]() |
7173ad9c9f | ||
![]() |
932ec58172 |
|
@ -62,7 +62,11 @@ module Admin
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_statuses
|
def set_statuses
|
||||||
@statuses = Admin::StatusFilter.new(@account, filter_params).results.preload(:application, :preloadable_poll, :media_attachments, active_mentions: :account, reblog: [:account, :application, :preloadable_poll, :media_attachments, active_mentions: :account]).page(params[:page]).per(PER_PAGE)
|
@statuses = Admin::StatusFilter.new(@account, {}).results.preload(*preload_columns, reblog: [:account, *preload_columns]).page(params[:page]).per(PER_PAGE)
|
||||||
|
end
|
||||||
|
|
||||||
|
def preload_columns
|
||||||
|
[:application, :preloadable_poll, :media_attachments, active_mentions: :account]
|
||||||
end
|
end
|
||||||
|
|
||||||
def filter_params
|
def filter_params
|
||||||
|
|
|
@ -44,6 +44,19 @@ class Status < ApplicationRecord
|
||||||
include Status::ThreadingConcern
|
include Status::ThreadingConcern
|
||||||
include Status::Visibility
|
include Status::Visibility
|
||||||
|
|
||||||
|
CACHEABLE_ASSOCIATIONS = [
|
||||||
|
:application,
|
||||||
|
:conversation,
|
||||||
|
:media_attachments,
|
||||||
|
:preloadable_poll,
|
||||||
|
:status_stat,
|
||||||
|
:tags,
|
||||||
|
account: [:account_stat, user: :role],
|
||||||
|
active_mentions: :account,
|
||||||
|
preview_cards_status: { preview_card: { author_account: [:account_stat, user: :role] } },
|
||||||
|
quote: { status: { account: [:account_stat, user: :role] } },
|
||||||
|
].freeze
|
||||||
|
|
||||||
MEDIA_ATTACHMENTS_LIMIT = 4
|
MEDIA_ATTACHMENTS_LIMIT = 4
|
||||||
|
|
||||||
QUOTE_APPROVAL_POLICY_FLAGS = {
|
QUOTE_APPROVAL_POLICY_FLAGS = {
|
||||||
|
@ -162,29 +175,11 @@ class Status < ApplicationRecord
|
||||||
# the `dependent: destroy` callbacks remove relevant records
|
# the `dependent: destroy` callbacks remove relevant records
|
||||||
before_destroy :unlink_from_conversations!, prepend: true
|
before_destroy :unlink_from_conversations!, prepend: true
|
||||||
|
|
||||||
cache_associated :application,
|
cache_associated(
|
||||||
:media_attachments,
|
*CACHEABLE_ASSOCIATIONS,
|
||||||
:conversation,
|
reblog: [*CACHEABLE_ASSOCIATIONS],
|
||||||
:status_stat,
|
thread: :account
|
||||||
:tags,
|
)
|
||||||
:preloadable_poll,
|
|
||||||
quote: { status: { account: [:account_stat, user: :role] } },
|
|
||||||
preview_cards_status: { preview_card: { author_account: [:account_stat, user: :role] } },
|
|
||||||
account: [:account_stat, user: :role],
|
|
||||||
active_mentions: :account,
|
|
||||||
reblog: [
|
|
||||||
:application,
|
|
||||||
:media_attachments,
|
|
||||||
:conversation,
|
|
||||||
:status_stat,
|
|
||||||
:tags,
|
|
||||||
:preloadable_poll,
|
|
||||||
quote: { status: { account: [:account_stat, user: :role] } },
|
|
||||||
preview_cards_status: { preview_card: { author_account: [:account_stat, user: :role] } },
|
|
||||||
account: [:account_stat, user: :role],
|
|
||||||
active_mentions: :account,
|
|
||||||
],
|
|
||||||
thread: :account
|
|
||||||
|
|
||||||
delegate :domain, :indexable?, to: :account, prefix: true
|
delegate :domain, :indexable?, to: :account, prefix: true
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user