Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
1e6d136a
Commit
1e6d136a
authored
Oct 11, 2016
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Keep cross project reference logic in GroupLabel#to_reference
parent
f74d5f27
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
11 deletions
+15
-11
app/models/group_label.rb
app/models/group_label.rb
+14
-2
lib/gitlab/gfm/reference_rewriter.rb
lib/gitlab/gfm/reference_rewriter.rb
+1
-9
No files found.
app/models/group_label.rb
View file @
1e6d136a
...
@@ -15,8 +15,20 @@ class GroupLabel < Label
...
@@ -15,8 +15,20 @@ class GroupLabel < Label
#
#
# Returns a String
# 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
)
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
end
end
lib/gitlab/gfm/reference_rewriter.rb
View file @
1e6d136a
...
@@ -76,15 +76,7 @@ module Gitlab
...
@@ -76,15 +76,7 @@ module Gitlab
if
referable
.
respond_to?
(
:project
)
if
referable
.
respond_to?
(
:project
)
referable
.
to_reference
(
target_project
)
referable
.
to_reference
(
target_project
)
else
else
to_reference
(
referable
,
target_project
)
referable
.
to_reference
(
@source_project
,
target_project
)
end
end
def
to_reference
(
referable
,
target_project
)
if
@source_project
!=
target_project
@source_project
.
to_reference
+
referable
.
to_reference
else
referable
.
to_reference
end
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment