diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2017-05-06 05:45:56 +0000 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2017-05-06 05:45:56 +0000 |
commit | 56fb7823f9740d4595d90dcb224180c950a27048 (patch) | |
tree | ebf2f5498f164477cfe594ea6b820202087532a9 /app/controllers/groups | |
parent | 6ce1df41e175c7d62ca760b1e66cf1bf86150284 (diff) | |
parent | b0ee22609a89572d6e3f98eebccf9fb2335dd939 (diff) | |
download | gitlab-ce-56fb7823f9740d4595d90dcb224180c950a27048.tar.gz |
Merge branch '17361-redirect-renamed-paths' into 'master'
Resolve "Redirect to new project link after a rename"
Closes #17361 and #30317
See merge request !11136
Diffstat (limited to 'app/controllers/groups')
-rw-r--r-- | app/controllers/groups/application_controller.rb | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/app/controllers/groups/application_controller.rb b/app/controllers/groups/application_controller.rb index 29ffaeb19c1..afffb813b44 100644 --- a/app/controllers/groups/application_controller.rb +++ b/app/controllers/groups/application_controller.rb @@ -1,4 +1,6 @@ class Groups::ApplicationController < ApplicationController + include RoutableActions + layout 'group' skip_before_action :authenticate_user! @@ -7,29 +9,17 @@ class Groups::ApplicationController < ApplicationController private def group - unless @group - id = params[:group_id] || params[:id] - @group = Group.find_by_full_path(id) - @group_merge_requests = MergeRequestsFinder.new(current_user, group_id: @group.id).execute - - unless @group && can?(current_user, :read_group, @group) - @group = nil - - if current_user.nil? - authenticate_user! - else - render_404 - end - end - end - - @group + @group ||= find_routable!(Group, params[:group_id] || params[:id]) end def group_projects @projects ||= GroupProjectsFinder.new(group: group, current_user: current_user).execute end + def group_merge_requests + @group_merge_requests = MergeRequestsFinder.new(current_user, group_id: @group.id).execute + end + def authorize_admin_group! unless can?(current_user, :admin_group, group) return render_404 |