diff options
author | Douwe Maan <douwe@gitlab.com> | 2016-04-04 15:37:08 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2016-04-04 15:37:08 +0000 |
commit | f505c753b02a7a0b41cc42a85ac15017af4ed86f (patch) | |
tree | d1ea34378c2fcf74db0c0b1937f14d3df84d4ff4 /app/models/merge_request.rb | |
parent | 5e8740eef01ff5263a8b75a96d2109dfae2c63c0 (diff) | |
parent | a6b5b50e14885a82530794c6ea35c940305244dd (diff) | |
download | gitlab-ce-f505c753b02a7a0b41cc42a85ac15017af4ed86f.tar.gz |
Merge branch 'fix_remove_fork_link' into 'master'
Remove fork link closes all merge requests opened on source project
Currently, if you:
- create a fork
- open a merge request on the source project
- remove the fork link
The created MR cannot be closed.
With this MR, all pending MR is closed when the fork link is removed.
See merge request !3189
Diffstat (limited to 'app/models/merge_request.rb')
-rw-r--r-- | app/models/merge_request.rb | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index 45c3b0a3a66..bf185cb5dd8 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -135,6 +135,7 @@ class MergeRequest < ActiveRecord::Base scope :cared, ->(user) { where('assignee_id = :user OR author_id = :user', user: user.id) } scope :by_milestone, ->(milestone) { where(milestone_id: milestone) } scope :of_projects, ->(ids) { where(target_project_id: ids) } + scope :from_project, ->(project) { where(source_project_id: project.id) } scope :merged, -> { with_state(:merged) } scope :closed_and_merged, -> { with_states(:closed, :merged) } |