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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
65d34388
Commit
65d34388
authored
Feb 07, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'bug/noteable_id' into 'master'
Fix bug with cross-reference note on commit Fixes #1018
parents
c03df58e
4ecf30cd
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
4 deletions
+20
-4
app/models/note.rb
app/models/note.rb
+10
-4
spec/models/note_spec.rb
spec/models/note_spec.rb
+10
-0
No files found.
app/models/note.rb
View file @
65d34388
...
...
@@ -72,14 +72,20 @@ class Note < ActiveRecord::Base
# +noteable+ was referenced from +mentioner+, by including GFM in either +mentioner+'s description or an associated Note.
# Create a system Note associated with +noteable+ with a GFM back-reference to +mentioner+.
def
create_cross_reference_note
(
noteable
,
mentioner
,
author
,
project
)
create
({
noteable:
noteable
,
commit_id:
(
noteable
.
sha
if
noteable
.
respond_to?
:sha
),
note_options
=
{
project:
project
,
author:
author
,
note:
"_mentioned in
#{
mentioner
.
gfm_reference
}
_"
,
system:
true
},
without_protection:
true
)
}
if
noteable
.
kind_of?
(
Commit
)
note_options
.
merge!
(
noteable_type:
'Commit'
,
commit_id:
noteable
.
id
)
else
note_options
.
merge!
(
noteable:
noteable
)
end
create
(
note_options
,
without_protection:
true
)
end
def
create_assignee_change_note
(
noteable
,
project
,
author
,
assignee
)
...
...
spec/models/note_spec.rb
View file @
65d34388
...
...
@@ -250,6 +250,16 @@ describe Note do
its
(
:project
)
{
should
==
project
}
its
(
:note
)
{
should
==
"_mentioned in merge request !
#{
mergereq
.
iid
}
_"
}
end
context
'commit from issue'
do
subject
{
Note
.
create_cross_reference_note
(
commit
,
issue
,
author
,
project
)
}
it
{
should
be_valid
}
its
(
:noteable_type
)
{
should
==
"Commit"
}
its
(
:noteable_id
)
{
should
be_nil
}
its
(
:commit_id
)
{
should
==
commit
.
id
}
its
(
:note
)
{
should
==
"_mentioned in issue #
#{
issue
.
iid
}
_"
}
end
end
describe
'#cross_reference_exists?'
do
...
...
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