summaryrefslogtreecommitdiff
path: root/config/routes.rb
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2015-09-07 09:27:48 +0000
committerDouwe Maan <douwe@gitlab.com>2015-09-07 09:27:48 +0000
commit662cf2cef40b97b983b85abb7d68b8a81b170bc3 (patch)
treeb3234b74551e0d5f57c4581dfeca225b0d39f8d5 /config/routes.rb
parentb9df4998607c64b758af641339edd40254900ecc (diff)
parentfbb891c8f3818b9aa17fadbb984ff7d33053c819 (diff)
downloadgitlab-ce-662cf2cef40b97b983b85abb7d68b8a81b170bc3.tar.gz
Merge branch 'fix-wiki-page-history' into 'master'
Fix broken Wiki Page History This MR fixes the broken Page History on the Wiki pages. It turns out `WikiHelper` did not allow users to view different versions due to its omitting of query string parameters, which was necessary to specify different `version_id` parameters. Instead of this hacky approach, use manually-specified wildcard routes that match the ID field properly for slashes. Closes #2104 Closes #1751 Closes #1592 Closes https://github.com/gitlabhq/gitlabhq/issues/9399 See merge request !1232
Diffstat (limited to 'config/routes.rb')
-rw-r--r--config/routes.rb22
1 files changed, 13 insertions, 9 deletions
diff --git a/config/routes.rb b/config/routes.rb
index a98c0f8aa77..25c286b3083 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -406,16 +406,20 @@ Gitlab::Application.routes.draw do
end
end
- resources :wikis, only: [:show, :edit, :destroy, :create], constraints: { id: /[a-zA-Z.0-9_\-\/]+/ } do
- collection do
- get :pages
- put ':id' => 'wikis#update'
- get :git_access
- end
+ WIKI_SLUG_ID = { id: /[a-zA-Z.0-9_\-\/]+/ } unless defined? WIKI_SLUG_ID
- member do
- get 'history'
- end
+ scope do
+ # Order matters to give priority to these matches
+ get '/wikis/git_access', to: 'wikis#git_access'
+ get '/wikis/pages', to: 'wikis#pages', as: 'wiki_pages'
+ post '/wikis', to: 'wikis#create'
+
+ get '/wikis/*id/history', to: 'wikis#history', as: 'wiki_history', constraints: WIKI_SLUG_ID
+ get '/wikis/*id/edit', to: 'wikis#edit', as: 'wiki_edit', constraints: WIKI_SLUG_ID
+
+ get '/wikis/*id', to: 'wikis#show', as: 'wiki', constraints: WIKI_SLUG_ID
+ delete '/wikis/*id', to: 'wikis#destroy', constraints: WIKI_SLUG_ID
+ put '/wikis/*id', to: 'wikis#update', constraints: WIKI_SLUG_ID
end
resource :repository, only: [:show, :create] do