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
Jérome Perrin
gitlab-ce
Commits
d65d245e
Commit
d65d245e
authored
Mar 31, 2017
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add link to diff header too
parent
2c0de7aa
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
14 deletions
+16
-14
app/helpers/notes_helper.rb
app/helpers/notes_helper.rb
+10
-3
app/views/discussions/_discussion.html.haml
app/views/discussions/_discussion.html.haml
+6
-11
No files found.
app/helpers/notes_helper.rb
View file @
d65d245e
...
...
@@ -61,10 +61,17 @@ module NotesHelper
end
def
discussion_diff_path
(
discussion
)
return
unless
discussion
.
diff_discussion?
if
discussion
.
for_merge_request?
if
discussion
.
active?
# Without a diff ID, the link always points to the latest diff version
diff_id
=
nil
elsif
merge_request_diff
=
discussion
.
latest_merge_request_diff
diff_id
=
merge_request_diff
.
id
else
return
end
if
discussion
.
for_merge_request?
&&
discussion
.
active?
diffs_namespace_project_merge_request_path
(
discussion
.
project
.
namespace
,
discussion
.
project
,
discussion
.
noteable
,
anchor:
discussion
.
line_code
)
diffs_namespace_project_merge_request_path
(
discussion
.
project
.
namespace
,
discussion
.
project
,
discussion
.
noteable
,
diff_id:
diff_id
,
anchor:
discussion
.
line_code
)
elsif
discussion
.
for_commit?
namespace_project_commit_path
(
discussion
.
project
.
namespace
,
discussion
.
project
,
discussion
.
noteable
,
anchor:
discussion
.
line_code
)
end
...
...
app/views/discussions/_discussion.html.haml
View file @
d65d245e
...
...
@@ -20,24 +20,19 @@
=
discussion
.
author
.
to_reference
started a discussion
-
url
=
discussion_diff_path
(
discussion
)
-
if
discussion
.
for_commit?
&&
@noteable
!=
discussion
.
noteable
on
-
commit
=
discussion
.
noteable
-
if
commit
commit
-
anchor
=
discussion
.
line_code
if
discussion
.
diff_discussion?
=
link_to
commit
.
short_id
,
namespace_project_commit_path
(
discussion
.
project
.
namespace
,
discussion
.
project
,
discussion
.
noteable
,
anchor:
anchor
),
class:
'monospace'
=
link_to
commit
.
short_id
,
discussion_diff_path
(
discussion
),
class:
'monospace'
-
else
a deleted commit
-
elsif
discussion
.
diff_discussion?
on
-
if
discussion
.
active?
=
link_to
'the diff'
,
discussion_diff_path
(
discussion
)
-
else
-
merge_request_diff
=
discussion
.
latest_merge_request_diff
-
if
merge_request_diff
=
link_to
diffs_namespace_project_merge_request_path
(
discussion
.
project
.
namespace
,
discussion
.
project
,
discussion
.
noteable
,
diff_id:
merge_request_diff
,
anchor:
discussion
.
line_code
)
do
an outdated diff
=
conditional_link_to
url
.
present?
,
url
do
-
if
discussion
.
active?
the diff
-
else
an outdated diff
...
...
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