WIP: unverified Codex job issue-485-z473g006
このコミットが含まれているのは:
@@ -16,7 +16,7 @@ class PostVersionsController < ApplicationController
|
||||
|
||||
q = HistoryAccess.visible(PostVersion.all)
|
||||
q = q.where('post_versions.post_id = ?', post_id) if post_id
|
||||
q = q.with_previous_version if tag_id || external_tag_id
|
||||
q = q.merge(version_scope) if tag_id || external_tag_id
|
||||
if external_tag_id || (tag_id && !(Tag.exists?(id: tag_id)))
|
||||
q = q.where('JSON_CONTAINS(post_versions.tags_json,' +
|
||||
"JSON_OBJECT('external_tag_id', #{ external_tag_id || tag_id })) " +
|
||||
@@ -29,11 +29,16 @@ class PostVersionsController < ApplicationController
|
||||
|
||||
count = q.except(:select, :order, :limit, :offset).count
|
||||
|
||||
# Apply visibility and pagination before joining the previous snapshots.
|
||||
# Reuse the authorised previous snapshot when it is needed for filtering.
|
||||
page_scope = q.order(Arel.sql('post_versions.created_at DESC, post_versions.id DESC'))
|
||||
.limit(limit).offset(offset).select('post_versions.*')
|
||||
versions = version_scope.from(page_scope, :post_versions)
|
||||
.order(Arel.sql('post_versions.created_at DESC, post_versions.id DESC'))
|
||||
.limit(limit).offset(offset)
|
||||
versions =
|
||||
if tag_id || external_tag_id
|
||||
page_scope
|
||||
else
|
||||
version_scope.from(page_scope.select('post_versions.*'), :post_versions)
|
||||
.order(Arel.sql('post_versions.created_at DESC, post_versions.id DESC'))
|
||||
end
|
||||
|
||||
render json: { versions: serialise_versions(versions, locale.language_code),
|
||||
count:, population_count: HistoryAccess.population_count(PostVersion) }
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする