Skip to content

Commit

Permalink
FEATURE: Move route to /docs
Browse files Browse the repository at this point in the history
After further discussion about the route, we landed on /docs as a better
choice. This commit makes that change.
  • Loading branch information
justindirose committed Jul 14, 2020
1 parent 25ca793 commit 14861e3
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
@@ -1,3 +1,3 @@
export default function() {
this.route("knowledgeExplorer", { path: "/e" });
this.route("knowledgeExplorer", { path: "/docs" });
}
Expand Up @@ -17,7 +17,7 @@ export default {
if (params.orderColumn) filters.push(`order=${params.orderColumn}`);
if (params.page) filters.push(`page=${params.page}`);

let promise = ajax(`/e.json?${filters.join("&")}`);
let promise = ajax(`/docs.json?${filters.join("&")}`);

if (params.selectedTopic) {
promise = promise.then(data => {
Expand Down
4 changes: 2 additions & 2 deletions lib/knowledge_explorer/engine.rb
Expand Up @@ -6,8 +6,8 @@ class Engine < ::Rails::Engine

config.after_initialize do
Discourse::Application.routes.append do
mount ::KnowledgeExplorer::Engine, at: '/e'
get '/knowledge-explorer', to: redirect("/e")
mount ::KnowledgeExplorer::Engine, at: '/docs'
get '/knowledge-explorer', to: redirect("/docs")
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/knowledge_explorer/query.rb
Expand Up @@ -168,7 +168,7 @@ def load_more_url
filters.push('page=1')
end

"/e.json?#{filters.join('&')}"
"/docs.json?#{filters.join('&')}"
end
end
end
14 changes: 7 additions & 7 deletions spec/requests/knowledge_explorer_controller_spec.rb
Expand Up @@ -18,7 +18,7 @@
describe 'knowledge explorer data' do
context 'when any user' do
it 'should return the right response' do
get '/e.json'
get '/docs.json'

expect(response.status).to eq(200)

Expand All @@ -41,7 +41,7 @@
end

it 'should not show topics in private categories without permissions' do
get '/e.json'
get '/docs.json'

json = JSON.parse(response.body)
topics = json['topics']['topic_list']['topics']
Expand All @@ -53,7 +53,7 @@
admin = Fabricate(:admin)
sign_in(admin)

get '/e.json'
get '/docs.json'

json = JSON.parse(response.body)
topics = json['topics']['topic_list']['topics']
Expand All @@ -64,7 +64,7 @@

context 'when filtering by tag' do
it 'should return a list filtered by tag' do
get '/e.json?tags=test'
get '/docs.json?tags=test'

expect(response.status).to eq(200)

Expand All @@ -86,7 +86,7 @@
end

it 'should return a list filtered by category' do
get "/e.json?category=#{category2.id}"
get "/docs.json?category=#{category2.id}"

expect(response.status).to eq(200)

Expand Down Expand Up @@ -116,7 +116,7 @@
end

it 'should correctly filter topics' do
get "/e.json?search=banana"
get "/docs.json?search=banana"

expect(response.status).to eq(200)

Expand All @@ -130,7 +130,7 @@

expect(topics.size).to eq(2)

get "/e.json?search=walk"
get "/docs.json?search=walk"

json = JSON.parse(response.body)
topics = json['topics']['topic_list']['topics']
Expand Down

0 comments on commit 14861e3

Please sign in to comment.