diff options
Diffstat (limited to 'app/assets/javascripts/notes.js')
-rw-r--r-- | app/assets/javascripts/notes.js | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/app/assets/javascripts/notes.js b/app/assets/javascripts/notes.js index 8ed40f36103..b5c59f34e87 100644 --- a/app/assets/javascripts/notes.js +++ b/app/assets/javascripts/notes.js @@ -22,7 +22,7 @@ import syntaxHighlight from '~/syntax_highlight'; import Autosave from './autosave'; import loadAwardsHandler from './awards_handler'; import CommentTypeToggle from './comment_type_toggle'; -import { deprecatedCreateFlash as Flash } from './flash'; +import createFlash from './flash'; import { defaultAutocompleteConfig } from './gfm_auto_complete'; import GLForm from './gl_form'; import axios from './lib/utils/axios_utils'; @@ -106,7 +106,7 @@ export default class Notes { this.collapseLongCommitList(); this.setViewType(view); - // We are in the Merge Requests page so we need another edit form for Changes tab + // We are in the merge requests page so we need another edit form for Changes tab if (getPagePath(1) === 'merge_requests') { $('.note-edit-form').clone().addClass('mr-note-edit-form').insertAfter('.note-edit-form'); } @@ -399,7 +399,11 @@ export default class Notes { 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.get(0)); + this.addFlash({ + message: noteEntity.errors.commands_only, + type: 'notice', + parent: this.parentTimeline.get(0), + }); this.refresh(); } return; @@ -620,20 +624,21 @@ export default class Notes { } else if ($form.hasClass('js-discussion-note-form')) { formParentTimeline = $form.closest('.discussion-notes').find('.notes'); } - return this.addFlash( - __( + return this.addFlash({ + message: __( 'Your comment could not be submitted! Please check your network connection and try again.', ), - 'alert', - formParentTimeline.get(0), - ); + type: 'alert', + parent: formParentTimeline.get(0), + }); } updateNoteError() { - // eslint-disable-next-line no-new - new Flash( - __('Your comment could not be updated! Please check your network connection and try again.'), - ); + createFlash({ + message: __( + 'Your comment could not be updated! Please check your network connection and try again.', + ), + }); } /** @@ -1289,7 +1294,7 @@ export default class Notes { } addFlash(...flashParams) { - this.flashContainer = new Flash(...flashParams); + this.flashContainer = createFlash(...flashParams); } clearFlash() { |