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
Tatuya Kamada
gitlab-ce
Commits
463ae8f5
Commit
463ae8f5
authored
Aug 12, 2016
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Force notes poll after commands have been executed
parent
0afb9601
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
33 deletions
+35
-33
app/assets/javascripts/notes.js
app/assets/javascripts/notes.js
+21
-19
app/services/notes/create_service.rb
app/services/notes/create_service.rb
+1
-1
spec/features/issues/user_uses_slash_commands_spec.rb
spec/features/issues/user_uses_slash_commands_spec.rb
+2
-2
spec/support/issuable_slash_commands_shared_examples.rb
spec/support/issuable_slash_commands_shared_examples.rb
+11
-11
No files found.
app/assets/javascripts/notes.js
View file @
463ae8f5
...
@@ -201,7 +201,7 @@
...
@@ -201,7 +201,7 @@
Increase @pollingInterval up to 120 seconds on every function call,
Increase @pollingInterval up to 120 seconds on every function call,
if `shouldReset` has a truthy value, 'null' or 'undefined' the variable
if `shouldReset` has a truthy value, 'null' or 'undefined' the variable
will reset to @basePollingInterval.
will reset to @basePollingInterval.
Note: this function is used to gradually increase the polling interval
Note: this function is used to gradually increase the polling interval
if there aren't new notes coming from the server
if there aren't new notes coming from the server
*/
*/
...
@@ -223,7 +223,7 @@
...
@@ -223,7 +223,7 @@
/*
/*
Render note in main comments area.
Render note in main comments area.
Note: for rendering inline notes use renderDiscussionNote
Note: for rendering inline notes use renderDiscussionNote
*/
*/
...
@@ -236,6 +236,7 @@
...
@@ -236,6 +236,7 @@
else
{
else
{
if
(
note
.
errors
.
commands_only
)
{
if
(
note
.
errors
.
commands_only
)
{
new
Flash
(
note
.
errors
.
commands_only
,
'
notice
'
,
this
.
parentTimeline
);
new
Flash
(
note
.
errors
.
commands_only
,
'
notice
'
,
this
.
parentTimeline
);
this
.
refresh
();
}
}
}
}
return
;
return
;
...
@@ -250,6 +251,7 @@
...
@@ -250,6 +251,7 @@
$notesList
.
append
(
note
.
html
).
syntaxHighlight
();
$notesList
.
append
(
note
.
html
).
syntaxHighlight
();
gl
.
utils
.
localTimeAgo
(
$notesList
.
find
(
"
#note_
"
+
note
.
id
+
"
.js-timeago
"
),
false
);
gl
.
utils
.
localTimeAgo
(
$notesList
.
find
(
"
#note_
"
+
note
.
id
+
"
.js-timeago
"
),
false
);
this
.
initTaskList
();
this
.
initTaskList
();
this
.
refresh
();
return
this
.
updateNotesCount
(
1
);
return
this
.
updateNotesCount
(
1
);
}
}
};
};
...
@@ -270,7 +272,7 @@
...
@@ -270,7 +272,7 @@
/*
/*
Render note in discussion area.
Render note in discussion area.
Note: for rendering inline notes use renderDiscussionNote
Note: for rendering inline notes use renderDiscussionNote
*/
*/
...
@@ -309,7 +311,7 @@
...
@@ -309,7 +311,7 @@
/*
/*
Called in response the main target form has been successfully submitted.
Called in response the main target form has been successfully submitted.
Removes any errors.
Removes any errors.
Resets text and preview.
Resets text and preview.
Resets buttons.
Resets buttons.
...
@@ -334,7 +336,7 @@
...
@@ -334,7 +336,7 @@
/*
/*
Shows the main form and does some setup on it.
Shows the main form and does some setup on it.
Sets some hidden fields in the form.
Sets some hidden fields in the form.
*/
*/
...
@@ -354,7 +356,7 @@
...
@@ -354,7 +356,7 @@
/*
/*
General note form setup.
General note form setup.
deactivates the submit button when text is empty
deactivates the submit button when text is empty
hides the preview button when text is empty
hides the preview button when text is empty
setup GFM auto complete
setup GFM auto complete
...
@@ -371,7 +373,7 @@
...
@@ -371,7 +373,7 @@
/*
/*
Called in response to the new note form being submitted
Called in response to the new note form being submitted
Adds new note to list.
Adds new note to list.
*/
*/
...
@@ -386,7 +388,7 @@
...
@@ -386,7 +388,7 @@
/*
/*
Called in response to the new note form being submitted
Called in response to the new note form being submitted
Adds new note to list.
Adds new note to list.
*/
*/
...
@@ -398,7 +400,7 @@
...
@@ -398,7 +400,7 @@
/*
/*
Called in response to the edit note form being submitted
Called in response to the edit note form being submitted
Updates the current note field.
Updates the current note field.
*/
*/
...
@@ -415,7 +417,7 @@
...
@@ -415,7 +417,7 @@
/*
/*
Called in response to clicking the edit note link
Called in response to clicking the edit note link
Replaces the note text with the note edit form
Replaces the note text with the note edit form
Adds a data attribute to the form with the original content of the note for cancellations
Adds a data attribute to the form with the original content of the note for cancellations
*/
*/
...
@@ -455,7 +457,7 @@
...
@@ -455,7 +457,7 @@
/*
/*
Called in response to clicking the edit note link
Called in response to clicking the edit note link
Hides edit form and restores the original note text to the editor textarea.
Hides edit form and restores the original note text to the editor textarea.
*/
*/
...
@@ -477,7 +479,7 @@
...
@@ -477,7 +479,7 @@
/*
/*
Called in response to deleting a note of any kind.
Called in response to deleting a note of any kind.
Removes the actual note from view.
Removes the actual note from view.
Removes the whole discussion if the last note is being removed.
Removes the whole discussion if the last note is being removed.
*/
*/
...
@@ -503,7 +505,7 @@
...
@@ -503,7 +505,7 @@
/*
/*
Called in response to clicking the delete attachment link
Called in response to clicking the delete attachment link
Removes the attachment wrapper view, including image tag if it exists
Removes the attachment wrapper view, including image tag if it exists
Resets the note editing form
Resets the note editing form
*/
*/
...
@@ -520,7 +522,7 @@
...
@@ -520,7 +522,7 @@
/*
/*
Called when clicking on the "reply" button for a diff line.
Called when clicking on the "reply" button for a diff line.
Shows the note form below the notes.
Shows the note form below the notes.
*/
*/
...
@@ -536,9 +538,9 @@
...
@@ -536,9 +538,9 @@
/*
/*
Shows the diff or discussion form and does some setup on it.
Shows the diff or discussion form and does some setup on it.
Sets some hidden fields in the form.
Sets some hidden fields in the form.
Note: dataHolder must have the "discussionId", "lineCode", "noteableType"
Note: dataHolder must have the "discussionId", "lineCode", "noteableType"
and "noteableId" data attributes set.
and "noteableId" data attributes set.
*/
*/
...
@@ -562,7 +564,7 @@
...
@@ -562,7 +564,7 @@
/*
/*
Called when clicking on the "add a comment" button on the side of a diff line.
Called when clicking on the "add a comment" button on the side of a diff line.
Inserts a temporary row for the form below the line.
Inserts a temporary row for the form below the line.
Sets up the form and shows it.
Sets up the form and shows it.
*/
*/
...
@@ -610,7 +612,7 @@
...
@@ -610,7 +612,7 @@
/*
/*
Called in response to "cancel" on a diff note form.
Called in response to "cancel" on a diff note form.
Shows the reply button again.
Shows the reply button again.
Removes the form and if necessary it's temporary row.
Removes the form and if necessary it's temporary row.
*/
*/
...
@@ -639,7 +641,7 @@
...
@@ -639,7 +641,7 @@
/*
/*
Called after an attachment file has been selected.
Called after an attachment file has been selected.
Updates the file name for the selected attachment.
Updates the file name for the selected attachment.
*/
*/
...
...
app/services/notes/create_service.rb
View file @
463ae8f5
...
@@ -28,7 +28,7 @@ module Notes
...
@@ -28,7 +28,7 @@ module Notes
# We must add the error after we call #save because errors are reset
# We must add the error after we call #save because errors are reset
# when #save is called
# when #save is called
if
slash_commands_service
.
execute
(
command_params
,
note
)
&&
note
.
note
.
blank?
if
slash_commands_service
.
execute
(
command_params
,
note
)
&&
note
.
note
.
blank?
note
.
errors
.
add
(
:commands_only
,
'Your commands
are being executed.
'
)
note
.
errors
.
add
(
:commands_only
,
'Your commands
have been executed!
'
)
end
end
note
note
...
...
spec/features/issues/user_uses_slash_commands_spec.rb
View file @
463ae8f5
...
@@ -27,7 +27,7 @@ feature 'Issues > User uses slash commands', feature: true, js: true do
...
@@ -27,7 +27,7 @@ feature 'Issues > User uses slash commands', feature: true, js: true do
end
end
expect
(
page
).
not_to
have_content
'/due_date 2016-08-28'
expect
(
page
).
not_to
have_content
'/due_date 2016-08-28'
expect
(
page
).
to
have_content
'Your commands
are being executed.
'
expect
(
page
).
to
have_content
'Your commands
have been executed!
'
issue
.
reload
issue
.
reload
...
@@ -47,7 +47,7 @@ feature 'Issues > User uses slash commands', feature: true, js: true do
...
@@ -47,7 +47,7 @@ feature 'Issues > User uses slash commands', feature: true, js: true do
end
end
expect
(
page
).
not_to
have_content
'/clear_due_date'
expect
(
page
).
not_to
have_content
'/clear_due_date'
expect
(
page
).
to
have_content
'Your commands
are being executed.
'
expect
(
page
).
to
have_content
'Your commands
have been executed!
'
issue
.
reload
issue
.
reload
...
...
spec/support/issuable_slash_commands_shared_examples.rb
View file @
463ae8f5
...
@@ -74,7 +74,7 @@ shared_examples 'issuable record that supports slash commands in its description
...
@@ -74,7 +74,7 @@ shared_examples 'issuable record that supports slash commands in its description
expect
(
page
).
not_to
have_content
'/assign @bob'
expect
(
page
).
not_to
have_content
'/assign @bob'
expect
(
page
).
not_to
have_content
'/label ~bug'
expect
(
page
).
not_to
have_content
'/label ~bug'
expect
(
page
).
not_to
have_content
'/milestone %"ASAP"'
expect
(
page
).
not_to
have_content
'/milestone %"ASAP"'
expect
(
page
).
to
have_content
'Your commands
are being executed.
'
expect
(
page
).
to
have_content
'Your commands
have been executed!
'
issuable
.
reload
issuable
.
reload
...
@@ -98,7 +98,7 @@ shared_examples 'issuable record that supports slash commands in its description
...
@@ -98,7 +98,7 @@ shared_examples 'issuable record that supports slash commands in its description
end
end
expect
(
page
).
not_to
have_content
'/close'
expect
(
page
).
not_to
have_content
'/close'
expect
(
page
).
to
have_content
'Your commands
are being executed.
'
expect
(
page
).
to
have_content
'Your commands
have been executed!
'
expect
(
issuable
.
reload
).
to
be_closed
expect
(
issuable
.
reload
).
to
be_closed
end
end
...
@@ -118,7 +118,7 @@ shared_examples 'issuable record that supports slash commands in its description
...
@@ -118,7 +118,7 @@ shared_examples 'issuable record that supports slash commands in its description
end
end
expect
(
page
).
not_to
have_content
'/close'
expect
(
page
).
not_to
have_content
'/close'
expect
(
page
).
not_to
have_content
'Your commands
are being executed.
'
expect
(
page
).
not_to
have_content
'Your commands
have been executed!
'
expect
(
issuable
).
to
be_open
expect
(
issuable
).
to
be_open
end
end
...
@@ -139,7 +139,7 @@ shared_examples 'issuable record that supports slash commands in its description
...
@@ -139,7 +139,7 @@ shared_examples 'issuable record that supports slash commands in its description
end
end
expect
(
page
).
not_to
have_content
'/reopen'
expect
(
page
).
not_to
have_content
'/reopen'
expect
(
page
).
to
have_content
'Your commands
are being executed.
'
expect
(
page
).
to
have_content
'Your commands
have been executed!
'
expect
(
issuable
.
reload
).
to
be_open
expect
(
issuable
.
reload
).
to
be_open
end
end
...
@@ -159,7 +159,7 @@ shared_examples 'issuable record that supports slash commands in its description
...
@@ -159,7 +159,7 @@ shared_examples 'issuable record that supports slash commands in its description
end
end
expect
(
page
).
not_to
have_content
'/reopen'
expect
(
page
).
not_to
have_content
'/reopen'
expect
(
page
).
not_to
have_content
'Your commands
are being executed.
'
expect
(
page
).
not_to
have_content
'Your commands
have been executed!
'
expect
(
issuable
).
to
be_closed
expect
(
issuable
).
to
be_closed
end
end
...
@@ -175,7 +175,7 @@ shared_examples 'issuable record that supports slash commands in its description
...
@@ -175,7 +175,7 @@ shared_examples 'issuable record that supports slash commands in its description
end
end
expect
(
page
).
not_to
have_content
'/title'
expect
(
page
).
not_to
have_content
'/title'
expect
(
page
).
to
have_content
'Your commands
are being executed.
'
expect
(
page
).
to
have_content
'Your commands
have been executed!
'
expect
(
issuable
.
reload
.
title
).
to
eq
'Awesome new title'
expect
(
issuable
.
reload
.
title
).
to
eq
'Awesome new title'
end
end
...
@@ -195,7 +195,7 @@ shared_examples 'issuable record that supports slash commands in its description
...
@@ -195,7 +195,7 @@ shared_examples 'issuable record that supports slash commands in its description
end
end
expect
(
page
).
not_to
have_content
'/title'
expect
(
page
).
not_to
have_content
'/title'
expect
(
page
).
not_to
have_content
'Your commands
are being executed.
'
expect
(
page
).
not_to
have_content
'Your commands
have been executed!
'
expect
(
issuable
.
reload
.
title
).
not_to
eq
'Awesome new title'
expect
(
issuable
.
reload
.
title
).
not_to
eq
'Awesome new title'
end
end
...
@@ -210,7 +210,7 @@ shared_examples 'issuable record that supports slash commands in its description
...
@@ -210,7 +210,7 @@ shared_examples 'issuable record that supports slash commands in its description
end
end
expect
(
page
).
not_to
have_content
'/todo'
expect
(
page
).
not_to
have_content
'/todo'
expect
(
page
).
to
have_content
'Your commands
are being executed.
'
expect
(
page
).
to
have_content
'Your commands
have been executed!
'
todos
=
TodosFinder
.
new
(
master
).
execute
todos
=
TodosFinder
.
new
(
master
).
execute
todo
=
todos
.
first
todo
=
todos
.
first
...
@@ -244,7 +244,7 @@ shared_examples 'issuable record that supports slash commands in its description
...
@@ -244,7 +244,7 @@ shared_examples 'issuable record that supports slash commands in its description
end
end
expect
(
page
).
not_to
have_content
'/done'
expect
(
page
).
not_to
have_content
'/done'
expect
(
page
).
to
have_content
'Your commands
are being executed.
'
expect
(
page
).
to
have_content
'Your commands
have been executed!
'
expect
(
todo
.
reload
).
to
be_done
expect
(
todo
.
reload
).
to
be_done
end
end
...
@@ -260,7 +260,7 @@ shared_examples 'issuable record that supports slash commands in its description
...
@@ -260,7 +260,7 @@ shared_examples 'issuable record that supports slash commands in its description
end
end
expect
(
page
).
not_to
have_content
'/subscribe'
expect
(
page
).
not_to
have_content
'/subscribe'
expect
(
page
).
to
have_content
'Your commands
are being executed.
'
expect
(
page
).
to
have_content
'Your commands
have been executed!
'
expect
(
issuable
.
subscribed?
(
master
)).
to
be_truthy
expect
(
issuable
.
subscribed?
(
master
)).
to
be_truthy
end
end
...
@@ -280,7 +280,7 @@ shared_examples 'issuable record that supports slash commands in its description
...
@@ -280,7 +280,7 @@ shared_examples 'issuable record that supports slash commands in its description
end
end
expect
(
page
).
not_to
have_content
'/unsubscribe'
expect
(
page
).
not_to
have_content
'/unsubscribe'
expect
(
page
).
to
have_content
'Your commands
are being executed.
'
expect
(
page
).
to
have_content
'Your commands
have been executed!
'
expect
(
issuable
.
subscribed?
(
master
)).
to
be_falsy
expect
(
issuable
.
subscribed?
(
master
)).
to
be_falsy
end
end
...
...
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