Skip to content

Commit

Permalink
Remove default_scope from StatusEdit class (mastodon#28042)
Browse files Browse the repository at this point in the history
  • Loading branch information
mjankowski authored Nov 23, 2023
1 parent 990c63b commit 4be1279
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/controllers/admin/statuses_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def batch
private

def batched_ordered_status_edits
@status.edits.reorder(nil).includes(:account, status: [:account]).find_each(order: :asc)
@status.edits.includes(:account, status: [:account]).find_each(order: :asc)
end
helper_method :batched_ordered_status_edits

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/api/v1/statuses/histories_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ def show
private

def status_edits
@status.edits.includes(:account, status: [:account]).to_a.presence || [@status.build_snapshot(at_time: @status.edited_at || @status.created_at)]
@status.edits.ordered.includes(:account, status: [:account]).to_a.presence || [@status.build_snapshot(at_time: @status.edited_at || @status.created_at)]
end
end
2 changes: 1 addition & 1 deletion app/models/status_edit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class PreservedMediaAttachment < ActiveModelSerializers::Model
belongs_to :status
belongs_to :account, optional: true

default_scope { order(id: :asc) }
scope :ordered, -> { order(id: :asc) }

delegate :local?, :application, :edited?, :edited_at,
:discarded?, :visibility, to: :status
Expand Down

0 comments on commit 4be1279

Please sign in to comment.