Fixes #3574 - Use country codes (e.g. DE
or ES
) for knowledgebase answer selection.
This commit is contained in:
parent
6636af8d34
commit
53d68b12ae
2 changed files with 22 additions and 1 deletions
|
@ -70,7 +70,7 @@ class KnowledgeBase::SearchController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
if include_locale && (system_locale = object.kb_locale.system_locale)
|
if include_locale && (system_locale = object.kb_locale.system_locale)
|
||||||
output[:title] += " (#{system_locale.name})"
|
output[:title] += " (#{system_locale.locale.upcase})"
|
||||||
end
|
end
|
||||||
|
|
||||||
output
|
output
|
||||||
|
|
|
@ -88,6 +88,27 @@ RSpec.describe 'Knowledge Base search with details', type: :request, searchindex
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'when using include_locale parameter' do
|
||||||
|
context 'when no multiple locales exists' do
|
||||||
|
it 'no locale added to title' do
|
||||||
|
post endpoint, params: { query: published_answer.translations.first.title, include_locale: true }
|
||||||
|
expect(json_response['details'][0]['title']).to not_include('(EN-US)')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when multiple locales exists' do
|
||||||
|
before do
|
||||||
|
# Create a alternative knowledge base locale.
|
||||||
|
alternative_locale
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'locale added to title' do
|
||||||
|
post endpoint, params: { query: published_answer.translations.first.title, include_locale: true }
|
||||||
|
expect(json_response['details'][0]['title']).to include('(EN-US)')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
context 'when using paging' do
|
context 'when using paging' do
|
||||||
let(:answers) do
|
let(:answers) do
|
||||||
Array.new(20) do |nth|
|
Array.new(20) do |nth|
|
||||||
|
|
Loading…
Reference in a new issue