Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
34605c244517
Commit
9a3ed265
authored
May 13, 2016
by
Douwe Maan
Browse files
Use `@diff_notes_disabled` instead of `@comments_allowed`
parent
8a5137a19c7e
Changes
6
Hide whitespace changes
Inline
Side-by-side
app/controllers/projects/commit_controller.rb
View file @
34605c24
...
...
@@ -22,7 +22,6 @@ def show
@note
=
@project
.
build_commit_note
(
commit
)
@notes
=
commit
.
notes
.
non_diff_notes
.
fresh
@noteable
=
@commit
@comments_allowed
=
true
@comments_target
=
{
noteable_type:
'Commit'
,
commit_id:
@commit
.
id
...
...
app/controllers/projects/compare_controller.rb
View file @
34605c24
...
...
@@ -22,6 +22,7 @@ def show
@base_commit
=
@project
.
merge_base_commit
(
@base_ref
,
@head_ref
)
@diffs
=
compare
.
diffs
(
diff_options
)
@diff_refs
=
[
@base_commit
,
@commit
]
@diff_notes_disabled
=
true
@grouped_diff_notes
=
{}
end
end
...
...
app/controllers/projects/merge_requests_controller.rb
View file @
34605c24
...
...
@@ -73,7 +73,6 @@ def diffs
# but we need it for the "View file @ ..." link by deleted files
@base_commit
||=
@merge_request
.
first_commit
.
parent
||
@merge_request
.
first_commit
@comments_allowed
=
true
@comments_target
=
{
noteable_type:
'MergeRequest'
,
noteable_id:
@merge_request
.
id
...
...
@@ -118,6 +117,7 @@ def new
@commit
=
@merge_request
.
last_commit
@base_commit
=
@merge_request
.
diff_base_commit
@diffs
=
@merge_request
.
compare
.
diffs
(
diff_options
)
if
@merge_request
.
compare
@diff_notes_disabled
=
true
@ci_commit
=
@merge_request
.
ci_commit
@statuses
=
@ci_commit
.
statuses
if
@ci_commit
...
...
app/views/projects/diffs/_line.html.haml
View file @
34605c24
...
...
@@ -15,7 +15,7 @@
=
link_text
-
else
=
link_to
""
,
"#
#{
line_code
}
"
,
id:
line_code
,
data:
{
linenumber:
link_text
}
-
if
@comments_allow
ed
&&
can?
(
current_user
,
:create_note
,
@project
)
-
if
!
@diff_notes_disabl
ed
&&
can?
(
current_user
,
:create_note
,
@project
)
=
link_to_new_diff_note
(
line_code
)
%td
.new_line.diff-line-num
{
class:
type
,
data:
{
linenumber:
line
.
new_pos
}
}
-
link_text
=
type
==
"old"
?
" "
.
html_safe
:
line
.
new_pos
...
...
app/views/projects/diffs/_parallel_view.html.haml
View file @
34605c24
...
...
@@ -16,7 +16,7 @@
-
else
%td
.old_line.diff-line-num
{
id:
left
[
:line_code
],
class:
"#{left[:type]} #{'empty-cell' if !left[:number]}"
}
=
link_to
raw
(
left
[
:number
]),
"#
#{
left
[
:line_code
]
}
"
,
id:
left
[
:line_code
]
-
if
@comments_allow
ed
&&
can?
(
current_user
,
:create_note
,
@project
)
-
if
!
@diff_notes_disabl
ed
&&
can?
(
current_user
,
:create_note
,
@project
)
=
link_to_new_diff_note
(
left
[
:line_code
],
'old'
)
%td
.line_content
{
class:
"parallel noteable_line #{left[:type]} #{left[:line_code]} #{'empty-cell' if left[:text].empty?}"
,
data:
{
line_code:
left
[
:line_code
]
}}=
diff_line_content
(
left
[
:text
])
...
...
@@ -29,11 +29,11 @@
%td
.new_line.diff-line-num
{
id:
new_line_code
,
class:
"#{new_line_class} #{'empty-cell' if !right[:number]}"
,
data:
{
linenumber:
right
[
:number
]
}}
=
link_to
raw
(
right
[
:number
]),
"#
#{
new_line_code
}
"
,
id:
new_line_code
-
if
@comments_allow
ed
&&
can?
(
current_user
,
:create_note
,
@project
)
-
if
!
@diff_notes_disabl
ed
&&
can?
(
current_user
,
:create_note
,
@project
)
=
link_to_new_diff_note
(
new_line_code
,
'new'
)
%td
.line_content.parallel
{
class:
"noteable_line #{new_line_class} #{new_line_code} #{'empty-cell' if right[:text].empty?}"
,
data:
{
line_code:
new_line_code
}}=
diff_line_content
(
right
[
:text
])
-
if
@comments_allow
ed
-
unless
@diff_notes_disabl
ed
-
notes_left
,
notes_right
=
organize_comments
(
left
,
right
)
-
if
notes_left
.
present?
||
notes_right
.
present?
=
render
"projects/notes/diff_notes_with_reply_parallel"
,
notes_left:
notes_left
,
notes_right:
notes_right
...
...
app/views/projects/diffs/_text_file.html.haml
View file @
34605c24
...
...
@@ -11,7 +11,7 @@
-
last_line
=
line
.
new_pos
=
render
"projects/diffs/line"
,
{
line:
line
,
diff_file:
diff_file
,
line_code:
line_code
}
-
if
@comments_allow
ed
-
unless
@diff_notes_disabl
ed
-
diff_notes
=
@grouped_diff_notes
[
line_code
]
-
if
diff_notes
=
render
"projects/notes/diff_notes_with_reply"
,
notes:
diff_notes
...
...
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