Redirect commits to root_ref if no ref is provided
This commit is contained in:
parent
0ed8f3490e
commit
11d56a1551
|
@ -63,6 +63,10 @@ class ApplicationController < ActionController::Base
|
||||||
render_503
|
render_503
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def redirect_commits_root
|
||||||
|
redirect_to :controller => 'commits', :action => 'show', :id => @repository.root_ref
|
||||||
|
end
|
||||||
|
|
||||||
def redirect_back_or_default(default: root_path, options: {})
|
def redirect_back_or_default(default: root_path, options: {})
|
||||||
redirect_to request.referer.present? ? :back : default, options
|
redirect_to request.referer.present? ? :back : default, options
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
title: Redirect commits to root if no ref is provided (31576)
|
||||||
|
merge_request:
|
||||||
|
author: Kia Mei Somabes
|
||||||
|
type: added
|
|
@ -83,6 +83,7 @@ scope format: false do
|
||||||
get '/raw/*id', to: 'raw#show', as: :raw
|
get '/raw/*id', to: 'raw#show', as: :raw
|
||||||
get '/blame/*id', to: 'blame#show', as: :blame
|
get '/blame/*id', to: 'blame#show', as: :blame
|
||||||
|
|
||||||
|
get '/commits/', to: 'application#redirect_commits_root', as: :commits_root
|
||||||
get '/commits/*id/signatures', to: 'commits#signatures', as: :signatures
|
get '/commits/*id/signatures', to: 'commits#signatures', as: :signatures
|
||||||
get '/commits/*id', to: 'commits#show', as: :commits
|
get '/commits/*id', to: 'commits#show', as: :commits
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue