このコミットが含まれているのは:
@@ -379,6 +379,37 @@ RSpec.describe 'Tags API', type: :request do
|
||||
expect(response).to have_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
it 'falls back to ExternalTag when no internal Tag has the id' do
|
||||
external = create(
|
||||
:external_tag,
|
||||
id: Tag.maximum(:id).to_i + 10_000,
|
||||
name: 'legacy_id_lookup')
|
||||
|
||||
get "/tags/#{ external.id }"
|
||||
|
||||
expect(response).to have_http_status(:ok)
|
||||
expect(json).to include(
|
||||
'id' => external.id,
|
||||
'name' => 'nico:legacy_id_lookup',
|
||||
'category' => 'nico')
|
||||
end
|
||||
|
||||
it 'prefers Tag when Tag and ExternalTag have the same id' do
|
||||
internal = create(:tag, name: 'internal_collision')
|
||||
create(
|
||||
:external_tag,
|
||||
id: internal.id,
|
||||
name: 'external_collision')
|
||||
|
||||
get "/tags/#{ internal.id }"
|
||||
|
||||
expect(response).to have_http_status(:ok)
|
||||
expect(json).to include(
|
||||
'id' => internal.id,
|
||||
'name' => 'internal_collision')
|
||||
expect(json.fetch('category')).not_to eq('nico')
|
||||
end
|
||||
end
|
||||
|
||||
describe 'GET /tags/autocomplete' do
|
||||
|
||||
@@ -16,8 +16,17 @@ RSpec.describe 'nico:sync' do
|
||||
end
|
||||
|
||||
def create_nico_sanitisation_rules!
|
||||
TagNameSanitisationRule.create!(priority: 20, source_pattern: '\\?', replacement: '_')
|
||||
TagNameSanitisationRule.create!(priority: 40, source_pattern: '_$', replacement: '')
|
||||
TagNameSanitisationRule.create!(priority: 20,
|
||||
source_pattern: '\\?',
|
||||
replacement: '_')
|
||||
|
||||
TagNameSanitisationRule.create!(priority: 40,
|
||||
source_pattern: '_$',
|
||||
replacement: '')
|
||||
|
||||
TagNameSanitisationRule.create!(priority: 45,
|
||||
source_pattern: '^([^:]+\\:)?_',
|
||||
replacement: '\\1')
|
||||
end
|
||||
|
||||
it '既存 post を見つけて、nico tag と linked tag を追加し、差分が出たら bot を付ける' do
|
||||
@@ -573,6 +582,7 @@ RSpec.describe 'nico:sync' do
|
||||
|
||||
it 'nico: prefix を含む従来の規則で外部タグ名をサニタイズする' do
|
||||
post = create_nico_sync_post!
|
||||
create_nico_sanitisation_rules!
|
||||
|
||||
run_nico_sync_with_tags!(['foo:_bar'])
|
||||
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする