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
88983257
Commit
88983257
authored
Apr 21, 2015
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix small issues.
parent
0db79443
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
6 deletions
+7
-6
app/models/note.rb
app/models/note.rb
+4
-4
spec/support/mentionable_shared_examples.rb
spec/support/mentionable_shared_examples.rb
+3
-2
No files found.
app/models/note.rb
View file @
88983257
...
...
@@ -238,7 +238,7 @@ class Note < ActiveRecord::Base
# Determine whether or not a cross-reference note already exists.
def
cross_reference_exists?
(
noteable
,
mentioner
)
gfm_reference
=
mentioner_gfm_ref
(
noteable
,
mentioner
,
nil
)
gfm_reference
=
mentioner_gfm_ref
(
noteable
,
mentioner
,
true
)
notes
=
if
noteable
.
is_a?
(
Commit
)
where
(
commit_id:
noteable
.
id
,
noteable_type:
'Commit'
)
else
...
...
@@ -271,12 +271,12 @@ class Note < ActiveRecord::Base
# Prepend the mentioner's namespaced project path to the GFM reference for
# cross-project references. For same-project references, return the
# unmodified GFM reference.
def
mentioner_gfm_ref
(
noteable
,
mentioner
,
mentioner_project
=
mentioner
.
project
)
if
mentioner
.
is_a?
(
Commit
)
&&
mentioner_project
.
nil?
def
mentioner_gfm_ref
(
noteable
,
mentioner
,
cross_reference
=
false
)
if
mentioner
.
is_a?
(
Commit
)
&&
cross_reference
return
mentioner
.
gfm_reference
.
sub
(
'commit '
,
'commit %'
)
end
full_gfm_reference
(
mentioner
_
project
,
noteable
.
project
,
mentioner
)
full_gfm_reference
(
mentioner
.
project
,
noteable
.
project
,
mentioner
)
end
# Return the +mentioner+ GFM reference. If the mentioner and noteable
...
...
spec/support/mentionable_shared_examples.rb
View file @
88983257
...
...
@@ -52,9 +52,10 @@ def common_mentionable_setup
}
extra_commits
.
each
{
|
c
|
commitmap
[
c
.
short_id
]
=
c
}
allow
(
project
.
repository
).
to
receive
(
:commit
)
{
|
sha
|
commitmap
[
sha
]
}
allow
(
project
).
to
receive
(
:commit
)
{
|
sha
|
commitmap
[
sha
]
}
set_mentionable_text
.
call
(
ref_string
)
subject
.
save
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