Remove `default_scope` from `StatusEdit` class (#28042)

main
Matt Jankowski 2023-11-23 04:26:11 -05:00 committed by GitHub
parent 990c63b440
commit 4be12791e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View File

@ -32,7 +32,7 @@ module Admin
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

View File

@ -11,6 +11,6 @@ class Api::V1::Statuses::HistoriesController < Api::V1::Statuses::BaseController
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

View File

@ -39,7 +39,7 @@ class StatusEdit < ApplicationRecord
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