Discourse Docs가 다른 포럼 소프트웨어 대신 Discourse를 선택하게 된 주요 이유입니다. 하지만 저에게는 치명적인 단점이 하나 있습니다. 기본적으로 활동(activity) 기준으로 정렬되는데, 이 활동 기준 정렬 기능을 완전히 제거하고 싶지만 방법을 모르겠습니다.
이 코드 섹션을 찾아서 활동 정렬을 위한 elsif 문장을 제거해 보았지만, 문제가 해결되지 않았습니다.
if @filters[:order] == "title"
if @filters[:ascending].present?
results = results.reorder('topics.title')
else
results = results.reorder('topics.title DESC')
end
elsif @filters[:order] == "activity"
if @filters[:ascending].present?
results = results.reorder('topics.last_posted_at')
else
results = results.reorder('topics.last_posted_at DESC')
end
end
이 파일에서도 동일한 작업을 수행해 보았지만, 여전히 동일한 정렬 기능이 제공됩니다.
context 'when ordering results' do
context 'by title' do
it 'should return the list ordered descending' do
get "/docs.json?order=title"
expect(response.status).to eq(200)
json = response.parsed_body
topics = json['topics']['topic_list']['topics']
expect(topics[0]['id']).to eq(topic2.id)
expect(topics[1]['id']).to eq(topic.id)
end
it 'should return the list ordered ascending with an additional parameter' do
get "/docs.json?order=title&ascending=true"
expect(response.status).to eq(200)
json = response.parsed_body
topics = json['topics']['topic_list']['topics']
expect(topics[0]['id']).to eq(topic.id)
expect(topics[1]['id']).to eq(topic2.id)
end
end
context 'by date' do
before do
topic2.update(last_posted_at: Time.zone.now + 100)
end
it 'should return the list ordered descending' do
get "/docs.json?order=activity"
expect(response.status).to eq(200)
json = response.parsed_body
topics = json['topics']['topic_list']['topics']
expect(topics[0]['id']).to eq(topic.id)
expect(topics[1]['id']).to eq(topic2.id)
end
it 'should return the list ordered ascending with an additional parameter' do
get "/docs.json?order=activity&ascending=true"
expect(response.status).to eq(200)
json = response.parsed_body
topics = json['topics']['topic_list']['topics']
expect(topics[0]['id']).to eq(topic2.id)
expect(topics[1]['id']).to eq(topic.id)
end
end
end
서버의 파일에 직접 수정을 가하기도 했고, Discourse Docs의 포크(fork)를 만들어 설치한 후에도 동일한 작업을 수행했습니다.
혹시 조언을 주실 분이 계신가요? 3분이면 끝날 거라고 생각했는데, 이미 몇 시간째 이 문제에 매달리고 있습니다…
감사합니다!