diff options
author | Bob Van Landuyt <bob@vanlanduyt.co> | 2018-04-06 13:47:52 +0300 |
---|---|---|
committer | Bob Van Landuyt <bob@vanlanduyt.co> | 2018-04-11 11:51:14 +0300 |
commit | ec43e3644436e0ae90f6fb6a64256c38ceb68cc9 (patch) | |
tree | ae0ad64114b9708cd04c43a3f398e9983aa62119 /app/controllers | |
parent | 267dba0ae56c6236b49907ad77fd572578c7b30e (diff) |
Prevent new merge requests for archived projects
This prevents creating merge requests targeting archived projects.
This could happen when a project was already forked, but then the
source was archived.
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/projects/application_controller.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/app/controllers/projects/application_controller.rb b/app/controllers/projects/application_controller.rb index 6d9b42a2c04..cbb14b55399 100644 --- a/app/controllers/projects/application_controller.rb +++ b/app/controllers/projects/application_controller.rb @@ -34,8 +34,12 @@ class Projects::ApplicationController < ApplicationController def can_collaborate_with_project?(project = nil, ref: nil) project ||= @project + can_create_merge_request = + can?(current_user, :create_merge_request_in_project, project) && + current_user.already_forked?(project) + can?(current_user, :push_code, project) || - (current_user && current_user.already_forked?(project)) || + can_create_merge_request || user_access(project).can_push_to_branch?(ref) end |