diff options
author | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-10-11 16:30:40 -0300 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-10-19 14:58:26 -0200 |
commit | 1e6d136af31b0b91a03881a0c20b9bfa448201ee (patch) | |
tree | 1d40a3f071a078c96ac86d1b16aa1aaaf1f57cee /app/models/group_label.rb | |
parent | f74d5f2750c638f30020ba727e2947b7207bf0e2 (diff) | |
download | gitlab-ce-1e6d136af31b0b91a03881a0c20b9bfa448201ee.tar.gz |
Keep cross project reference logic in GroupLabel#to_reference
Diffstat (limited to 'app/models/group_label.rb')
-rw-r--r-- | app/models/group_label.rb | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/app/models/group_label.rb b/app/models/group_label.rb index bfcaf3df27e..c7efa29a5f6 100644 --- a/app/models/group_label.rb +++ b/app/models/group_label.rb @@ -15,8 +15,20 @@ class GroupLabel < Label # # Returns a String # - def to_reference(from_project = nil, format: :id) + def to_reference(source_project = nil, target_project = nil, format: :id) format_reference = label_format_reference(format) - "#{self.class.reference_prefix}#{format_reference}" + reference = "#{self.class.reference_prefix}#{format_reference}" + + if cross_project_reference?(source_project, target_project) + source_project.to_reference + reference + else + reference + end + end + + private + + def cross_project_reference?(source_project, target_project) + source_project && target_project && source_project != target_project end end |