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

pull/28053/head
Matt Jankowski 1 year ago committed by GitHub
parent 990c63b440
commit 4be12791e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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

@ -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

@ -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

Loading…
Cancel
Save