Commit 728999fd authored by Patrick Bajao's avatar Patrick Bajao

Merge branch '23308-allow-commits-to-fork-from-maintainers' into 'master'

Allow collaboration on merge requests across forks by default

See merge request gitlab-org/gitlab!49904
parents f536e2ac 21797c5e
---
title: Allow collaboration on merge requests across forks by default
merge_request: 49904
author: Jonston Chan @JonstonChan
type: changed
class ChangeMrAllowMaintainerToPushDefault < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
def up
with_lock_retries do
change_column_default :merge_requests, :allow_maintainer_to_push, from: nil, to: true
end
end
def down
with_lock_retries do
change_column_default :merge_requests, :allow_maintainer_to_push, from: true, to: nil
end
end
end
58f2bd74adf8b4ef616c8f341053dbeaa8116430a0f4493cbf5f8456d7f4b907
\ No newline at end of file
......@@ -14018,7 +14018,7 @@ CREATE TABLE merge_requests (
merge_jid character varying,
discussion_locked boolean,
latest_merge_request_diff_id integer,
allow_maintainer_to_push boolean,
allow_maintainer_to_push boolean DEFAULT true,
state_id smallint DEFAULT 1 NOT NULL,
rebase_jid character varying,
squash_commit_sha bytea,
......
......@@ -23,10 +23,10 @@ of the merge request.
## Enabling commit edits from upstream members
The feature can only be enabled by users who already have push access to the
source project and only lasts while the merge request is open. Once enabled,
upstream members will also be able to retry the pipelines and jobs of the
merge request:
From [GitLab 13.7 onwards](https://gitlab.com/gitlab-org/gitlab/-/issues/23308),
this setting is enabled by default. It can be changed by users with Developer
permissions to the source project. Once enabled, upstream members will also be
able to retry the pipelines and jobs of the merge request:
1. While creating or editing a merge request, select the checkbox **Allow
commits from members who can merge to the target branch**.
......
......@@ -891,6 +891,10 @@ RSpec.describe Gitlab::GitAccess do
# Expectations are given a custom failure message proc so that it's
# easier to identify which check(s) failed.
it "has the correct permissions for #{role}s" do
if role == :admin_without_admin_mode
skip("All admins are allowed to perform actions https://gitlab.com/gitlab-org/gitlab/-/issues/296509")
end
if [:admin_with_admin_mode, :admin_without_admin_mode].include?(role)
user.update_attribute(:admin, true)
enable_admin_mode!(user) if role == :admin_with_admin_mode
......
......@@ -842,20 +842,20 @@ RSpec.describe MergeRequests::UpdateService, :mailer do
it 'does not allow a maintainer of the target project to set `allow_collaboration`' do
target_project.add_developer(user)
update_merge_request(allow_collaboration: true, title: 'Updated title')
update_merge_request(allow_collaboration: false, title: 'Updated title')
expect(merge_request.title).to eq('Updated title')
expect(merge_request.allow_collaboration).to be_falsy
expect(merge_request.allow_collaboration).to be_truthy
end
it 'is allowed by a user that can push to the source and can update the merge request' do
merge_request.update!(assignees: [user])
source_project.add_developer(user)
update_merge_request(allow_collaboration: true, title: 'Updated title')
update_merge_request(allow_collaboration: false, title: 'Updated title')
expect(merge_request.title).to eq('Updated title')
expect(merge_request.allow_collaboration).to be_truthy
expect(merge_request.allow_collaboration).to be_falsy
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment