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
5efbfa14
Commit
5efbfa14
authored
Jan 13, 2016
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move complex view condition to a model method
This is moved to a model method rather than an helper method because the API will need it too.
parent
9d7f88c1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
1 deletion
+8
-1
note.rb
app/models/note.rb
+4
-0
_notes.html.haml
app/views/projects/notes/_notes.html.haml
+4
-1
No files found.
app/models/note.rb
View file @
5efbfa14
...
...
@@ -358,6 +358,10 @@ class Note < ActiveRecord::Base
!
system
?
&&
!
is_award
end
def
cross_reference_not_visible_for?
(
user
)
cross_reference?
&&
referenced_mentionables
(
user
).
empty?
end
# Checks if note is an award added as a comment
#
# If note is an award, this method sets is_award to true
...
...
app/views/projects/notes/_notes.html.haml
View file @
5efbfa14
...
...
@@ -2,11 +2,14 @@
-
@discussions
.
each
do
|
discussion_notes
|
-
note
=
discussion_notes
.
first
-
if
note_for_main_target?
(
note
)
-
next
if
note
.
cross_reference_not_visible_for?
(
current_user
)
=
render
discussion_notes
-
else
=
render
'projects/notes/discussion'
,
discussion_notes:
discussion_notes
-
else
-
@notes
.
each
do
|
note
|
-
next
unless
note
.
author
-
next
if
note
.
cross_reference?
&&
note
.
referenced_mentionables
(
current_user
).
empty?
-
next
if
note
.
cross_reference_not_visible_for?
(
current_user
)
=
render
note
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