summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/notes.js
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2017-05-09 14:09:07 +0100
committerFilipa Lacerda <filipa@gitlab.com>2017-05-09 14:09:07 +0100
commit0c3abe3ef92fe4d982b780397e8ace37a51aca45 (patch)
tree4781ef63fa315d5a2a0edff6340d38e84db8847b /app/assets/javascripts/notes.js
parentd3b124e473e051d424070b93c1e800fab7c08656 (diff)
parent387b44103c168d9a1b82997101deb60c61b6aaf1 (diff)
downloadgitlab-ce-31053-pipeline-ux.tar.gz
Merge branch 'master' into 31053-pipeline-ux31053-pipeline-ux
* master: Fallback to default pattern when note does not belong to project Merge request widget redesign Fixed focused test in notes spec Fixed UP arrow key not editing last comment in discussion Fix skipped manual actions issue in pipeline processing Fix notify_only_default_branch check for Slack service
Diffstat (limited to 'app/assets/javascripts/notes.js')
-rw-r--r--app/assets/javascripts/notes.js14
1 files changed, 11 insertions, 3 deletions
diff --git a/app/assets/javascripts/notes.js b/app/assets/javascripts/notes.js
index 55391ebc089..194c29f4710 100644
--- a/app/assets/javascripts/notes.js
+++ b/app/assets/javascripts/notes.js
@@ -175,7 +175,7 @@ const normalizeNewlines = function(str) {
if ($textarea.val() !== '') {
return;
}
- myLastNote = $("li.note[data-author-id='" + gon.current_user_id + "'][data-editable]:last");
+ myLastNote = $(`li.note[data-author-id='${gon.current_user_id}'][data-editable]:last`, $textarea.closest('.note, #notes'));
if (myLastNote.length) {
myLastNoteEditBtn = myLastNote.find('.js-note-edit');
return myLastNoteEditBtn.trigger('click', [true, myLastNote]);
@@ -276,7 +276,7 @@ const normalizeNewlines = function(str) {
var votesBlock;
if (noteEntity.commands_changes) {
if ('merge' in noteEntity.commands_changes) {
- $.get(mrRefreshWidgetUrl);
+ Notes.checkMergeRequestStatus();
}
if ('emoji_award' in noteEntity.commands_changes) {
@@ -424,6 +424,7 @@ const normalizeNewlines = function(str) {
}
gl.utils.localTimeAgo($('.js-timeago'), false);
+ Notes.checkMergeRequestStatus();
return this.updateNotesCount(1);
};
@@ -769,7 +770,8 @@ const normalizeNewlines = function(str) {
}
};
})(this));
- // Decrement the "Discussions" counter only once
+
+ Notes.checkMergeRequestStatus();
return this.updateNotesCount(-1);
};
@@ -1115,6 +1117,12 @@ const normalizeNewlines = function(str) {
return $form;
};
+ Notes.checkMergeRequestStatus = function() {
+ if (gl.utils.getPagePath(1) === 'merge_requests') {
+ gl.mrWidget.checkStatus();
+ }
+ };
+
Notes.animateAppendNote = function(noteHtml, $notesList) {
const $note = $(noteHtml);