Remove `default_scope` from `StatusEdit` class (#28042)
This commit is contained in:
parent
990c63b440
commit
4be12791e6
|
@ -32,7 +32,7 @@ module Admin
|
||||||
private
|
private
|
||||||
|
|
||||||
def batched_ordered_status_edits
|
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
|
end
|
||||||
helper_method :batched_ordered_status_edits
|
helper_method :batched_ordered_status_edits
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,6 @@ class Api::V1::Statuses::HistoriesController < Api::V1::Statuses::BaseController
|
||||||
private
|
private
|
||||||
|
|
||||||
def status_edits
|
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
|
||||||
end
|
end
|
||||||
|
|
|
@ -39,7 +39,7 @@ class StatusEdit < ApplicationRecord
|
||||||
belongs_to :status
|
belongs_to :status
|
||||||
belongs_to :account, optional: true
|
belongs_to :account, optional: true
|
||||||
|
|
||||||
default_scope { order(id: :asc) }
|
scope :ordered, -> { order(id: :asc) }
|
||||||
|
|
||||||
delegate :local?, :application, :edited?, :edited_at,
|
delegate :local?, :application, :edited?, :edited_at,
|
||||||
:discarded?, :visibility, to: :status
|
:discarded?, :visibility, to: :status
|
||||||
|
|
Loading…
Reference in New Issue