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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
0d9347f9
Commit
0d9347f9
authored
May 22, 2020
by
Arun Kumar Mohan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix filename duplication in design notes in activity feeds
parent
6cfe09c4
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
46 additions
and
2 deletions
+46
-2
app/helpers/notes_helper.rb
app/helpers/notes_helper.rb
+7
-0
app/views/events/event/_note.html.haml
app/views/events/event/_note.html.haml
+4
-2
changelogs/unreleased/fix-design-notes-filename-duplication.yml
...logs/unreleased/fix-design-notes-filename-duplication.yml
+5
-0
spec/helpers/notes_helper_spec.rb
spec/helpers/notes_helper_spec.rb
+30
-0
No files found.
app/helpers/notes_helper.rb
View file @
0d9347f9
...
@@ -3,6 +3,13 @@
...
@@ -3,6 +3,13 @@
module
NotesHelper
module
NotesHelper
MAX_PRERENDERED_NOTES
=
10
MAX_PRERENDERED_NOTES
=
10
def
note_target_title
(
note
)
# The design title is already present in `Event#note_target_reference`.
return
if
note
.
nil?
||
note
.
for_design?
note
.
title
end
def
note_target_fields
(
note
)
def
note_target_fields
(
note
)
if
note
.
noteable
if
note
.
noteable
hidden_field_tag
(
:target_type
,
note
.
noteable
.
class
.
name
.
underscore
)
+
hidden_field_tag
(
:target_type
,
note
.
noteable
.
class
.
name
.
underscore
)
+
...
...
app/views/events/event/_note.html.haml
View file @
0d9347f9
...
@@ -7,8 +7,10 @@
...
@@ -7,8 +7,10 @@
%span
.event-type.d-inline-block.append-right-4
{
class:
event
.
action_name
}
%span
.event-type.d-inline-block.append-right-4
{
class:
event
.
action_name
}
=
event
.
action_name
=
event
.
action_name
=
event_note_title_html
(
event
)
=
event_note_title_html
(
event
)
-
title
=
note_target_title
(
event
.
target
)
-
if
title
.
present?
%span
.event-target-title.append-right-4
{
dir:
"auto"
}
%span
.event-target-title.append-right-4
{
dir:
"auto"
}
=
"""
.
html_safe
+
event
.
target
.
title
+
"""
.
html_safe
=
"""
.
html_safe
+
title
+
"""
.
html_safe
=
render
"events/event_scope"
,
event:
event
=
render
"events/event_scope"
,
event:
event
...
...
changelogs/unreleased/fix-design-notes-filename-duplication.yml
0 → 100644
View file @
0d9347f9
---
title
:
Fix filename duplication in design notes in activity feeds
merge_request
:
32823
author
:
Arun Kumar Mohan
type
:
fixed
spec/helpers/notes_helper_spec.rb
View file @
0d9347f9
...
@@ -24,6 +24,36 @@ describe NotesHelper do
...
@@ -24,6 +24,36 @@ describe NotesHelper do
project
.
add_guest
(
guest
)
project
.
add_guest
(
guest
)
end
end
describe
'#note_target_title'
do
context
'note does not exist'
do
it
'returns nil'
do
expect
(
helper
.
note_target_title
(
nil
)).
to
be_blank
end
end
context
'target does not exist'
do
it
'returns nil'
do
note
=
Note
.
new
expect
(
helper
.
note_target_title
(
note
)).
to
be_blank
end
end
context
'when given a design target'
do
it
'returns nil'
do
note
=
build_stubbed
(
:note_on_design
)
expect
(
helper
.
note_target_title
(
note
)).
to
be_blank
end
end
context
'when given a non-design target'
do
it
'returns the issue title'
do
issue
=
build_stubbed
(
:issue
,
title:
'Issue 1'
)
note
=
build_stubbed
(
:note
,
noteable:
issue
)
expect
(
helper
.
note_target_title
(
note
)).
to
eq
(
'Issue 1'
)
end
end
end
describe
"#notes_max_access_for_users"
do
describe
"#notes_max_access_for_users"
do
it
'returns access levels'
do
it
'returns access levels'
do
expect
(
helper
.
note_max_access_for_user
(
owner_note
)).
to
eq
(
Gitlab
::
Access
::
OWNER
)
expect
(
helper
.
note_max_access_for_user
(
owner_note
)).
to
eq
(
Gitlab
::
Access
::
OWNER
)
...
...
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