diff options
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/admin/projects_controller.rb | 27 | ||||
-rw-r--r-- | app/controllers/profiles/personal_access_tokens_controller.rb | 5 |
2 files changed, 29 insertions, 3 deletions
diff --git a/app/controllers/admin/projects_controller.rb b/app/controllers/admin/projects_controller.rb index 5d37bd27302..70c2d262b72 100644 --- a/app/controllers/admin/projects_controller.rb +++ b/app/controllers/admin/projects_controller.rb @@ -3,10 +3,10 @@ class Admin::ProjectsController < Admin::ApplicationController include MembersPresentation - before_action :project, only: [:show, :transfer, :repository_check, :destroy] + before_action :project, only: [:show, :transfer, :repository_check, :destroy, :edit, :update] before_action :group, only: [:show, :transfer] - feature_category :projects, [:index, :show, :transfer, :destroy] + feature_category :projects, [:index, :show, :transfer, :destroy, :edit, :update] feature_category :source_code_management, [:repository_check] def index @@ -62,6 +62,18 @@ class Admin::ProjectsController < Admin::ApplicationController end # rubocop: enable CodeReuse/ActiveRecord + def edit; end + + def update + result = ::Projects::UpdateService.new(@project, current_user, project_params).execute + + if result[:status] == :success + redirect_to [:admin, @project], notice: format(_("Project '%{project_name}' was successfully updated."), project_name: @project.name) + else + render "edit" + end + end + def repository_check RepositoryCheck::SingleRepositoryWorker.perform_async(@project.id) # rubocop:disable CodeReuse/Worker @@ -83,6 +95,17 @@ class Admin::ProjectsController < Admin::ApplicationController def group @group ||= @project.group end + + def project_params + params.require(:project).permit(allowed_project_params) + end + + def allowed_project_params + [ + :description, + :name + ] + end end Admin::ProjectsController.prepend_mod_with('Admin::ProjectsController') diff --git a/app/controllers/profiles/personal_access_tokens_controller.rb b/app/controllers/profiles/personal_access_tokens_controller.rb index 8d5c690fbfe..4b6e2f768fa 100644 --- a/app/controllers/profiles/personal_access_tokens_controller.rb +++ b/app/controllers/profiles/personal_access_tokens_controller.rb @@ -25,7 +25,10 @@ class Profiles::PersonalAccessTokensController < Profiles::ApplicationController def create result = ::PersonalAccessTokens::CreateService.new( - current_user: current_user, target_user: current_user, params: personal_access_token_params + current_user: current_user, + target_user: current_user, + params: personal_access_token_params, + concatenate_errors: false ).execute @personal_access_token = result.payload[:personal_access_token] |