mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-16 16:16:43 +10:00
Remove unnecessary namespaced resource
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
class Admin::MembersController < Admin::ApplicationController
|
||||
def destroy
|
||||
user = User.find_by_username(params[:id])
|
||||
project = Project.find_with_namespace(params[:project_id])
|
||||
project.users_projects.where(user_id: user).first.destroy
|
||||
|
||||
redirect_to :back
|
||||
end
|
||||
end
|
||||
@@ -1,11 +0,0 @@
|
||||
# Provides a base class for Admin controllers to subclass
|
||||
#
|
||||
# Automatically sets the layout and ensures an administrator is logged in
|
||||
class Admin::Projects::ApplicationController < Admin::ApplicationController
|
||||
|
||||
protected
|
||||
|
||||
def project
|
||||
@project ||= Project.find_with_namespace(params[:project_id])
|
||||
end
|
||||
end
|
||||
@@ -1,17 +0,0 @@
|
||||
class Admin::Projects::MembersController < Admin::Projects::ApplicationController
|
||||
def destroy
|
||||
team_member_relation.destroy
|
||||
|
||||
redirect_to :back
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def team_member
|
||||
@member ||= project.users.find_by_username(params[:id])
|
||||
end
|
||||
|
||||
def team_member_relation
|
||||
team_member.users_projects.find_by_project_id(project)
|
||||
end
|
||||
end
|
||||
+1
-3
@@ -88,9 +88,7 @@ Gitlab::Application.routes.draw do
|
||||
resource :background_jobs, controller: 'background_jobs', only: [:show]
|
||||
|
||||
resources :projects, constraints: { id: /[a-zA-Z.\/0-9_\-]+/ }, only: [:index, :show] do
|
||||
scope module: :projects, constraints: { id: /[a-zA-Z.\/0-9_\-]+/ } do
|
||||
resources :members, only: [:destroy]
|
||||
end
|
||||
resources :members, only: [:destroy]
|
||||
end
|
||||
|
||||
root to: "dashboard#index"
|
||||
|
||||
Reference in New Issue
Block a user