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
Léo-Paul Géneau
gitlab-ce
Commits
3f72af99
Commit
3f72af99
authored
Oct 10, 2012
by
Riyad Preukschas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make notes for merge requests include commit notes and add helpers
parent
dda852a0
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
2 deletions
+16
-2
app/contexts/notes/load_context.rb
app/contexts/notes/load_context.rb
+1
-1
app/controllers/notes_controller.rb
app/controllers/notes_controller.rb
+5
-0
app/helpers/notes_helper.rb
app/helpers/notes_helper.rb
+5
-0
app/models/note.rb
app/models/note.rb
+5
-1
No files found.
app/contexts/notes/load_context.rb
View file @
3f72af99
...
...
@@ -13,7 +13,7 @@ module Notes
when
"issue"
project
.
issues
.
find
(
target_id
).
notes
.
inc_author
.
fresh
.
limit
(
20
)
when
"merge_request"
project
.
merge_requests
.
find
(
target_id
).
notes
.
inc_author
.
fresh
.
limit
(
20
)
project
.
merge_requests
.
find
(
target_id
).
mr_and_commit_
notes
.
inc_author
.
fresh
.
limit
(
20
)
when
"snippet"
project
.
snippets
.
find
(
target_id
).
notes
.
fresh
when
"wall"
...
...
app/controllers/notes_controller.rb
View file @
3f72af99
...
...
@@ -7,6 +7,11 @@ class NotesController < ProjectResourceController
def
index
notes
if
params
[
:target_type
]
==
"merge_request"
@mixed_targets
=
true
@main_target_type
=
params
[
:target_type
].
camelize
end
respond_with
(
@notes
)
end
...
...
app/helpers/notes_helper.rb
View file @
3f72af99
...
...
@@ -7,6 +7,11 @@ module NotesHelper
params
[
:loading_new
].
present?
end
# Helps to distinguish e.g. commit notes in mr notes list
def
note_for_main_target?
(
note
)
!
@mixed_targets
||
@main_target_type
==
note
.
noteable_type
end
def
note_vote_class
(
note
)
if
note
.
upvote?
"vote upvote"
...
...
app/models/note.rb
View file @
3f72af99
...
...
@@ -49,7 +49,7 @@ class Note < ActiveRecord::Base
end
def
target
if
noteable_type
==
"Commit"
if
commit?
project
.
commit
(
noteable_id
)
else
noteable
...
...
@@ -82,6 +82,10 @@ class Note < ActiveRecord::Base
noteable_type
==
"Commit"
end
def
line_note?
line_code
.
present?
end
def
commit_author
@commit_author
||=
project
.
users
.
find_by_email
(
target
.
author_email
)
||
...
...
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