BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
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
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
7 deletions
+4
-7
label.rb
app/models/label.rb
+4
-3
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