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
Boxiang Sun
gitlab-ce
Commits
9e3ef082
Commit
9e3ef082
authored
Jun 30, 2017
by
Kushal Pandya
Committed by
Phil Hughes
Jun 30, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove placeholder note when award emoji slash command is applied
parent
1a449b24
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
0 deletions
+49
-0
app/assets/javascripts/notes.js
app/assets/javascripts/notes.js
+4
-0
spec/javascripts/notes_spec.js
spec/javascripts/notes_spec.js
+45
-0
No files found.
app/assets/javascripts/notes.js
View file @
9e3ef082
...
...
@@ -337,6 +337,10 @@ export default class Notes {
if
(
!
noteEntity
.
valid
)
{
if
(
noteEntity
.
errors
.
commands_only
)
{
if
(
noteEntity
.
commands_changes
&&
Object
.
keys
(
noteEntity
.
commands_changes
).
length
>
0
)
{
$notesList
.
find
(
'
.system-note.being-posted
'
).
remove
();
}
this
.
addFlash
(
noteEntity
.
errors
.
commands_only
,
'
notice
'
,
this
.
parentTimeline
);
this
.
refresh
();
}
...
...
spec/javascripts/notes_spec.js
View file @
9e3ef082
...
...
@@ -523,6 +523,51 @@ import '~/notes';
});
});
describe
(
'
postComment with Slash commands
'
,
()
=>
{
const
sampleComment
=
'
/assign @root
\n
/award :100:
'
;
const
note
=
{
commands_changes
:
{
assignee_id
:
1
,
emoji_award
:
'
100
'
},
errors
:
{
commands_only
:
[
'
Commands applied
'
]
},
valid
:
false
};
let
$form
;
let
$notesContainer
;
beforeEach
(()
=>
{
this
.
notes
=
new
Notes
(
''
,
[]);
window
.
gon
.
current_username
=
'
root
'
;
window
.
gon
.
current_user_fullname
=
'
Administrator
'
;
gl
.
awardsHandler
=
{
addAwardToEmojiBar
:
()
=>
{},
scrollToAwards
:
()
=>
{}
};
gl
.
GfmAutoComplete
=
{
dataSources
:
{
commands
:
'
/root/test-project/autocomplete_sources/commands
'
}
};
$form
=
$
(
'
form.js-main-target-form
'
);
$notesContainer
=
$
(
'
ul.main-notes-list
'
);
$form
.
find
(
'
textarea.js-note-text
'
).
val
(
sampleComment
);
});
it
(
'
should remove slash command placeholder when comment with slash commands is done posting
'
,
()
=>
{
const
deferred
=
$
.
Deferred
();
spyOn
(
$
,
'
ajax
'
).
and
.
returnValue
(
deferred
.
promise
());
spyOn
(
gl
.
awardsHandler
,
'
addAwardToEmojiBar
'
).
and
.
callThrough
();
$
(
'
.js-comment-button
'
).
click
();
expect
(
$notesContainer
.
find
(
'
.system-note.being-posted
'
).
length
).
toEqual
(
1
);
// Placeholder shown
deferred
.
resolve
(
note
);
expect
(
$notesContainer
.
find
(
'
.system-note.being-posted
'
).
length
).
toEqual
(
0
);
// Placeholder removed
});
});
describe
(
'
update comment with script tags
'
,
()
=>
{
const
sampleComment
=
'
<script></script>
'
;
const
updatedComment
=
'
<script></script>
'
;
...
...
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