Commit 10d8e6ce authored by Mike Greiling's avatar Mike Greiling

Merge branch 'chore/iife-removal' into 'master'

Remove IIFEs from notes

Closes #34611

See merge request gitlab-org/gitlab!20025
parents 9d20bc02 01cddb79
/* eslint-disable no-restricted-properties, func-names, no-var, camelcase, /* eslint-disable no-restricted-properties, no-var, camelcase,
no-unused-expressions, one-var, default-case, no-unused-expressions, one-var, default-case,
consistent-return, no-alert, no-return-assign, consistent-return, no-alert, no-param-reassign, no-else-return,
no-param-reassign, no-else-return, vars-on-top, vars-on-top, no-shadow, no-useless-escape,
no-shadow, no-useless-escape, class-methods-use-this */ class-methods-use-this */
/* global ResolveService */ /* global ResolveService */
...@@ -281,14 +281,7 @@ export default class Notes { ...@@ -281,14 +281,7 @@ export default class Notes {
if (Notes.interval) { if (Notes.interval) {
clearInterval(Notes.interval); clearInterval(Notes.interval);
} }
return (Notes.interval = setInterval( Notes.interval = setInterval(() => this.refresh(), this.pollingInterval);
(function(_this) {
return function() {
return _this.refresh();
};
})(this),
this.pollingInterval,
));
} }
refresh() { refresh() {
...@@ -847,15 +840,12 @@ export default class Notes { ...@@ -847,15 +840,12 @@ export default class Notes {
var noteElId, $note; var noteElId, $note;
$note = $(e.currentTarget).closest('.note'); $note = $(e.currentTarget).closest('.note');
noteElId = $note.attr('id'); noteElId = $note.attr('id');
$(`.note[id="${noteElId}"]`).each( $(`.note[id="${noteElId}"]`).each((i, el) => {
(function() {
// A same note appears in the "Discussion" and in the "Changes" tab, we have // A same note appears in the "Discussion" and in the "Changes" tab, we have
// to remove all. Using $('.note[id='noteId']') ensure we get all the notes, // to remove all. Using $('.note[id='noteId']') ensure we get all the notes,
// where $('#noteId') would return only one. // where $('#noteId') would return only one.
return function(i, el) { const $note = $(el);
var $note, $notes; const $notes = $note.closest('.discussion-notes');
$note = $(el);
$notes = $note.closest('.discussion-notes');
const discussionId = $('.notes', $notes).data('discussionId'); const discussionId = $('.notes', $notes).data('discussionId');
if (typeof gl.diffNotesCompileComponents !== 'undefined') { if (typeof gl.diffNotesCompileComponents !== 'undefined') {
...@@ -868,7 +858,7 @@ export default class Notes { ...@@ -868,7 +858,7 @@ export default class Notes {
// check if this is the last note for this line // check if this is the last note for this line
if ($notes.find('.note').length === 0) { if ($notes.find('.note').length === 0) {
var notesTr = $notes.closest('tr'); const notesTr = $notes.closest('tr');
// "Discussions" tab // "Discussions" tab
$notes.closest('.timeline-entry').remove(); $notes.closest('.timeline-entry').remove();
...@@ -895,9 +885,7 @@ export default class Notes { ...@@ -895,9 +885,7 @@ export default class Notes {
notesTr.remove(); notesTr.remove();
} }
} }
}; });
})(this),
);
Notes.checkMergeRequestStatus(); Notes.checkMergeRequestStatus();
return this.updateNotesCount(-1); return this.updateNotesCount(-1);
......
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