Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
01cddb79
Commit
01cddb79
authored
Nov 13, 2019
by
Arun Kumar Mohan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove IIFEs from notes
parent
9faa870e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
56 deletions
+44
-56
app/assets/javascripts/notes.js
app/assets/javascripts/notes.js
+44
-56
No files found.
app/assets/javascripts/notes.js
View file @
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-assig
n,
consistent-return, no-alert, no-
param-reassign, no-else-retur
n,
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,57 +840,52 @@ export default class Notes {
...
@@ -847,57 +840,52 @@ 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.
const
$note
=
$
(
el
);
return
function
(
i
,
el
)
{
const
$notes
=
$note
.
closest
(
'
.discussion-notes
'
);
var
$note
,
$notes
;
const
discussionId
=
$
(
'
.notes
'
,
$notes
).
data
(
'
discussionId
'
);
$note
=
$
(
el
);
$notes
=
$note
.
closest
(
'
.discussion-notes
'
);
if
(
typeof
gl
.
diffNotesCompileComponents
!==
'
undefined
'
)
{
const
discussionId
=
$
(
'
.notes
'
,
$notes
).
data
(
'
discussionId
'
);
if
(
gl
.
diffNoteApps
[
noteElId
])
{
gl
.
diffNoteApps
[
noteElId
].
$destroy
();
if
(
typeof
gl
.
diffNotesCompileComponents
!==
'
undefined
'
)
{
}
if
(
gl
.
diffNoteApps
[
noteElId
])
{
}
gl
.
diffNoteApps
[
noteElId
].
$destroy
();
}
}
$note
.
remove
();
// check if this is the last note for this line
$note
.
remove
();
if
(
$notes
.
find
(
'
.note
'
).
length
===
0
)
{
var
notesTr
=
$notes
.
closest
(
'
tr
'
);
// "Discussions" tab
// check if this is the last note for this line
$notes
.
closest
(
'
.timeline-entry
'
).
remove
();
if
(
$notes
.
find
(
'
.note
'
).
length
===
0
)
{
const
notesTr
=
$notes
.
closest
(
'
tr
'
);
$
(
`.js-diff-avatars-
${
discussionId
}
`
).
trigger
(
'
remove.vue
'
);
// "Discussions" tab
$notes
.
closest
(
'
.timeline-entry
'
).
remove
();
// The notes tr can contain multiple lists of notes, like on the parallel diff
$
(
`.js-diff-avatars-
${
discussionId
}
`
).
trigger
(
'
remove.vue
'
);
// notesTr does not exist for image diffs
if
(
notesTr
.
find
(
'
.discussion-notes
'
).
length
>
1
||
notesTr
.
length
===
0
)
{
const
$diffFile
=
$notes
.
closest
(
'
.diff-file
'
);
if
(
$diffFile
.
length
>
0
)
{
const
removeBadgeEvent
=
new
CustomEvent
(
'
removeBadge.imageDiff
'
,
{
detail
:
{
// badgeNumber's start with 1 and index starts with 0
badgeNumber
:
$notes
.
index
()
+
1
,
},
});
$diffFile
[
0
].
dispatchEvent
(
removeBadgeEvent
);
// The notes tr can contain multiple lists of notes, like on the parallel diff
}
// notesTr does not exist for image diffs
if
(
notesTr
.
find
(
'
.discussion-notes
'
).
length
>
1
||
notesTr
.
length
===
0
)
{
const
$diffFile
=
$notes
.
closest
(
'
.diff-file
'
);
if
(
$diffFile
.
length
>
0
)
{
const
removeBadgeEvent
=
new
CustomEvent
(
'
removeBadge.imageDiff
'
,
{
detail
:
{
// badgeNumber's start with 1 and index starts with 0
badgeNumber
:
$notes
.
index
()
+
1
,
},
});
$notes
.
remove
();
$diffFile
[
0
].
dispatchEvent
(
removeBadgeEvent
);
}
else
if
(
notesTr
.
length
>
0
)
{
notesTr
.
remove
();
}
}
}
};
})(
this
),
$notes
.
remove
();
);
}
else
if
(
notesTr
.
length
>
0
)
{
notesTr
.
remove
();
}
}
});
Notes
.
checkMergeRequestStatus
();
Notes
.
checkMergeRequestStatus
();
return
this
.
updateNotesCount
(
-
1
);
return
this
.
updateNotesCount
(
-
1
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment