mirror of
https://github.com/mastodon/mastodon.git
synced 2025-09-06 18:01:05 +00:00
Merge 10e17cc2f6
into 9a2be25199
This commit is contained in:
commit
b4777a69bc
|
@ -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
|
||||||
|
|
|
@ -45,6 +45,19 @@ class Status < ApplicationRecord
|
||||||
include Status::Visibility
|
include Status::Visibility
|
||||||
include Status::InteractionPolicyConcern
|
include Status::InteractionPolicyConcern
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
rate_limit by: :account, family: :statuses
|
rate_limit by: :account, family: :statuses
|
||||||
|
@ -157,29 +170,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,
|
|
||||||
: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
|
thread: :account
|
||||||
|
)
|
||||||
|
|
||||||
delegate :domain, :indexable?, to: :account, prefix: true
|
delegate :domain, :indexable?, to: :account, prefix: true
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user