AI: address review on PR #489
このコミットが含まれているのは:
@@ -335,6 +335,31 @@ RSpec.describe 'Post history privacy', type: :request do
|
||||
expect(response.parsed_body.fetch('versions').pluck('version_no')).to eq(expected)
|
||||
expect(response.parsed_body.fetch('count')).to eq(expected.length)
|
||||
end
|
||||
|
||||
it 'selects the highest external version within each post timestamp' do
|
||||
# Equal and out-of-order timestamps must still use version order.
|
||||
snapshots = [
|
||||
[2, 2.hours, tag.id.to_s], [3, 2.hours, tag.id.to_s],
|
||||
[4, 1.hour, ''], [5, 8.days, tag.id.to_s]]
|
||||
snapshots.each do |number, time, linked|
|
||||
NicoTagVersion.create!(external_tag: external, version_no: number,
|
||||
event_type: 'update', linked_tag_ids: linked, created_at: origin + time)
|
||||
end
|
||||
[6, 9].each_with_index do |days, index|
|
||||
PostVersion.create!(post: post_record, version_no: index + 5,
|
||||
event_type: 'update', title: 'external version selection',
|
||||
url: post_record.url, tags: '', tags_json: [{ external_tag_id: external.id }],
|
||||
parent_post_ids: '', created_at: origin + days.days)
|
||||
end
|
||||
|
||||
get '/posts/versions', params: { post: post_record.id, external_tag: external.id }
|
||||
|
||||
expect(response).to have_http_status(:ok)
|
||||
body = response.parsed_body
|
||||
expected = role == 'admin' ? [6, 5, 4] : [5, 4]
|
||||
expect(body.fetch('versions').pluck('version_no')).to eq(expected)
|
||||
expect(body.fetch('count')).to eq(expected.length)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする