Commit 463ae8f5 authored by Douwe Maan's avatar Douwe Maan

Force notes poll after commands have been executed

parent 0afb9601
...@@ -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);
} }
}; };
......
...@@ -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
......
...@@ -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
......
...@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment