8ad9c4e873
So we can distinguish between the permissions on the source and the target project. - `create_merge_request_from` indicates a user can create a merge request with the project as a source_project - `create_merge_request_in` indicates a user can create a merge request with the project as a target_project
20 lines
566 B
Ruby
20 lines
566 B
Ruby
module CompareHelper
|
|
def create_mr_button?(from = params[:from], to = params[:to], project = @project)
|
|
from.present? &&
|
|
to.present? &&
|
|
from != to &&
|
|
can?(current_user, :create_merge_request_from, project) &&
|
|
project.repository.branch_exists?(from) &&
|
|
project.repository.branch_exists?(to)
|
|
end
|
|
|
|
def create_mr_path(from = params[:from], to = params[:to], project = @project)
|
|
project_new_merge_request_path(
|
|
project,
|
|
merge_request: {
|
|
source_branch: to,
|
|
target_branch: from
|
|
}
|
|
)
|
|
end
|
|
end
|