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
iv
gitlab-ce
Commits
fa639df5
Commit
fa639df5
authored
Mar 03, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove redundant code in cross project labels implementation
parent
34769efa
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
7 deletions
+4
-7
app/models/label.rb
app/models/label.rb
+4
-3
lib/banzai/filter/label_reference_filter.rb
lib/banzai/filter/label_reference_filter.rb
+0
-4
No files found.
app/models/label.rb
View file @
fa639df5
...
...
@@ -85,7 +85,8 @@ class Label < ActiveRecord::Base
# Returns a String
#
def
to_reference
(
from_project
=
nil
,
format: :id
)
reference
=
label_format_reference
(
format
)
format_reference
=
label_format_reference
(
format
)
reference
=
"
#{
self
.
class
.
reference_prefix
}#{
format_reference
}
"
if
cross_project_reference?
(
from_project
)
project
.
to_reference
+
reference
...
...
@@ -116,9 +117,9 @@ class Label < ActiveRecord::Base
raise
StandardError
,
'Unknown format'
unless
[
:id
,
:name
].
include?
(
format
)
if
format
==
:name
&&
!
name
.
include?
(
'"'
)
%(
#{self.class.reference_prefix}
"#{name}")
%("#{name}")
else
"
#{
self
.
class
.
reference_prefix
}#{
id
}
"
id
end
end
end
lib/banzai/filter/label_reference_filter.rb
View file @
fa639df5
...
...
@@ -16,10 +16,6 @@ module Banzai
end
end
def
self
.
referenced_by
(
node
)
{
label:
LazyReference
.
new
(
Label
,
node
.
attr
(
"data-label"
))
}
end
def
references_in
(
text
,
pattern
=
Label
.
reference_pattern
)
text
.
gsub
(
pattern
)
do
|
match
|
project
=
project_from_ref
(
$~
[
:project
])
...
...
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