From d3cf0c247bcd665742047828aa8198ada43705f1 Mon Sep 17 00:00:00 2001 From: Tim Zallmann Date: Wed, 5 Sep 2018 13:23:42 +0200 Subject: Fix for Karma, Static Analysis and RSPec for MR Page --- app/assets/javascripts/notes.js | 56 +++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 30 deletions(-) (limited to 'app/assets/javascripts/notes.js') diff --git a/app/assets/javascripts/notes.js b/app/assets/javascripts/notes.js index 1e168742667..2296fd28793 100644 --- a/app/assets/javascripts/notes.js +++ b/app/assets/javascripts/notes.js @@ -47,6 +47,7 @@ const REGEX_QUICK_ACTIONS = /^\/\w+.*$/gm; export default class Notes { static initialize(notes_url, note_ids, last_fetched_at, view, enableGFM) { + alert('LALA'); if (!this.instance) { this.instance = new Notes(notes_url, note_ids, last_fetched_at, view, enableGFM); } @@ -154,7 +155,11 @@ export default class Notes { this.$wrapperEl.on('click', '.system-note-commit-list-toggler', this.toggleCommitList); this.$wrapperEl.on('click', '.js-toggle-lazy-diff', this.loadLazyDiff); - this.$wrapperEl.on('click', '.js-toggle-lazy-diff-retry-button', this.onClickRetryLazyLoad.bind(this)); + this.$wrapperEl.on( + 'click', + '.js-toggle-lazy-diff-retry-button', + this.onClickRetryLazyLoad.bind(this), + ); // fetch notes when tab becomes visible this.$wrapperEl.on('visibilitychange', this.visibilityChange); @@ -252,9 +257,7 @@ export default class Notes { discussionNoteForm = $textarea.closest('.js-discussion-note-form'); if (discussionNoteForm.length) { if ($textarea.val() !== '') { - if ( - !window.confirm('Are you sure you want to cancel creating this comment?') - ) { + if (!window.confirm('Are you sure you want to cancel creating this comment?')) { return; } } @@ -266,9 +269,7 @@ export default class Notes { originalText = $textarea.closest('form').data('originalNote'); newText = $textarea.val(); if (originalText !== newText) { - if ( - !window.confirm('Are you sure you want to cancel editing this comment?') - ) { + if (!window.confirm('Are you sure you want to cancel editing this comment?')) { return; } } @@ -469,6 +470,7 @@ export default class Notes { * Render note in discussion area. To render inline notes use renderDiscussionNote. */ renderDiscussionNote(noteEntity, $form) { + console.log('RENDER DISC NOTE'); var discussionContainer, form, row, lineType, diffAvatarContainer; if (!Notes.isNewNote(noteEntity, this.note_ids)) { @@ -1130,6 +1132,7 @@ export default class Notes { * Removes the form and if necessary it's temporary row. */ removeDiscussionNoteForm(form) { + console.log('REM DISC'); var glForm, row; row = form.closest('tr'); glForm = form.data('glForm'); @@ -1316,8 +1319,7 @@ export default class Notes { $retryButton.prop('disabled', true); - return this.loadLazyDiff(e) - .then(() => { + return this.loadLazyDiff(e).then(() => { $retryButton.prop('disabled', false); }); } @@ -1343,18 +1345,18 @@ export default class Notes { */ if (url) { return axios - .get(url) - .then(({ data }) => { - // Reset state in case last request returned error - $successContainer.removeClass('hidden'); - $errorContainer.addClass('hidden'); - - Notes.renderDiffContent($container, data); - }) - .catch(() => { - $successContainer.addClass('hidden'); - $errorContainer.removeClass('hidden'); - }); + .get(url) + .then(({ data }) => { + // Reset state in case last request returned error + $successContainer.removeClass('hidden'); + $errorContainer.addClass('hidden'); + + Notes.renderDiffContent($container, data); + }) + .catch(() => { + $successContainer.addClass('hidden'); + $errorContainer.removeClass('hidden'); + }); } return Promise.resolve(); } @@ -1545,12 +1547,8 @@ export default class Notes {
@@ -1565,9 +1563,7 @@ export default class Notes { ); $tempNote.find('.d-none.d-sm-inline-block').text(_.escape(currentUserFullname)); - $tempNote - .find('.note-headline-light') - .text(`@${_.escape(currentUsername)}`); + $tempNote.find('.note-headline-light').text(`@${_.escape(currentUsername)}`); return $tempNote; } -- cgit v1.2.1 From 93a947a10cc1fbe37a8921900011dbb405e9ca5f Mon Sep 17 00:00:00 2001 From: Tim Zallmann Date: Wed, 5 Sep 2018 13:53:34 +0200 Subject: Removed Console.log --- app/assets/javascripts/notes.js | 2 -- 1 file changed, 2 deletions(-) (limited to 'app/assets/javascripts/notes.js') diff --git a/app/assets/javascripts/notes.js b/app/assets/javascripts/notes.js index 2296fd28793..20f38ceca0e 100644 --- a/app/assets/javascripts/notes.js +++ b/app/assets/javascripts/notes.js @@ -470,7 +470,6 @@ export default class Notes { * Render note in discussion area. To render inline notes use renderDiscussionNote. */ renderDiscussionNote(noteEntity, $form) { - console.log('RENDER DISC NOTE'); var discussionContainer, form, row, lineType, diffAvatarContainer; if (!Notes.isNewNote(noteEntity, this.note_ids)) { @@ -1132,7 +1131,6 @@ export default class Notes { * Removes the form and if necessary it's temporary row. */ removeDiscussionNoteForm(form) { - console.log('REM DISC'); var glForm, row; row = form.closest('tr'); glForm = form.data('glForm'); -- cgit v1.2.1 From a0dc392362d880fe80853258929678e75f9cc345 Mon Sep 17 00:00:00 2001 From: Tim Zallmann Date: Wed, 5 Sep 2018 15:31:05 +0200 Subject: Fix Linting Error --- app/assets/javascripts/notes.js | 1 - 1 file changed, 1 deletion(-) (limited to 'app/assets/javascripts/notes.js') diff --git a/app/assets/javascripts/notes.js b/app/assets/javascripts/notes.js index 20f38ceca0e..8b1d8f6055e 100644 --- a/app/assets/javascripts/notes.js +++ b/app/assets/javascripts/notes.js @@ -47,7 +47,6 @@ const REGEX_QUICK_ACTIONS = /^\/\w+.*$/gm; export default class Notes { static initialize(notes_url, note_ids, last_fetched_at, view, enableGFM) { - alert('LALA'); if (!this.instance) { this.instance = new Notes(notes_url, note_ids, last_fetched_at, view, enableGFM); } -- cgit v1.2.1