diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/accounts_controller.rb | 4 | ||||
-rw-r--r-- | app/models/status.rb | 3 | ||||
-rw-r--r-- | app/models/stream_entry.rb | 1 |
3 files changed, 5 insertions, 3 deletions
diff --git a/app/controllers/accounts_controller.rb b/app/controllers/accounts_controller.rb index dd7c46b4e..3e580448e 100644 --- a/app/controllers/accounts_controller.rb +++ b/app/controllers/accounts_controller.rb @@ -6,12 +6,12 @@ class AccountsController < ApplicationController def show respond_to do |format| format.html do - @statuses = @account.statuses.permitted_for(@account, current_account).order(id: :desc).paginate_by_max_id(20, params[:max_id], params[:since_id]) + @statuses = @account.statuses.permitted_for(@account, current_account).recent.paginate_by_max_id(20, params[:max_id], params[:since_id]) @statuses = cache_collection(@statuses, Status) end format.atom do - @entries = @account.stream_entries.order(id: :desc).where(hidden: false).with_includes.paginate_by_max_id(20, params[:max_id], params[:since_id]) + @entries = @account.stream_entries.recent.where(hidden: false).with_includes.paginate_by_max_id(20, params[:max_id], params[:since_id]) render xml: AtomSerializer.render(AtomSerializer.new.feed(@account, @entries.to_a)) end diff --git a/app/models/status.rb b/app/models/status.rb index d7304152f..a3dbce9f1 100644 --- a/app/models/status.rb +++ b/app/models/status.rb @@ -55,8 +55,9 @@ class Status < ApplicationRecord validates_with StatusLengthValidator validates :reblog, uniqueness: { scope: :account }, if: :reblog? - default_scope { order(id: :desc) } + default_scope { recent } + scope :recent, -> { reorder(id: :desc) } scope :remote, -> { where.not(uri: nil) } scope :local, -> { where(uri: nil) } diff --git a/app/models/stream_entry.rb b/app/models/stream_entry.rb index fb349f35c..44aac39b3 100644 --- a/app/models/stream_entry.rb +++ b/app/models/stream_entry.rb @@ -25,6 +25,7 @@ class StreamEntry < ApplicationRecord STATUS_INCLUDES = [:account, :stream_entry, :conversation, :media_attachments, :tags, mentions: :account, reblog: [:stream_entry, :account, :conversation, :media_attachments, :tags, mentions: :account], thread: [:stream_entry, :account]].freeze default_scope { where(activity_type: 'Status') } + scope :recent, -> { reorder(id: :desc) } scope :with_includes, -> { includes(:account, status: STATUS_INCLUDES) } delegate :target, :title, :content, :thread, |