summaryrefslogtreecommitdiff
path: root/app/assets
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-04-04 06:10:42 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2023-04-04 06:10:42 +0000
commitf3f3149fc5249ad27378e4f2c22b8c3ff429a493 (patch)
treef50aec11527fd4f336bc0cf03387be828c66cd3c /app/assets
parent0555f8b0429486b14e36f92152587030db33708c (diff)
downloadgitlab-ce-f3f3149fc5249ad27378e4f2c22b8c3ff429a493.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets')
-rw-r--r--app/assets/javascripts/deprecated_notes.js21
1 files changed, 11 insertions, 10 deletions
diff --git a/app/assets/javascripts/deprecated_notes.js b/app/assets/javascripts/deprecated_notes.js
index 70be08a8d7c..537c810bcff 100644
--- a/app/assets/javascripts/deprecated_notes.js
+++ b/app/assets/javascripts/deprecated_notes.js
@@ -1398,7 +1398,7 @@ export default class Notes {
*/
static isNewNote(noteEntity, note_ids) {
if (note_ids.length === 0) {
- Notes.loadNotesIds(note_ids);
+ note_ids = Notes.getNotesIds();
}
const isNewEntry = $.inArray(noteEntity.id, note_ids) === -1;
if (isNewEntry) {
@@ -1408,16 +1408,17 @@ export default class Notes {
}
/**
- * Load notes ids
+ * Get notes ids
*/
- static loadNotesIds(note_ids) {
- const $notesList = $('.main-notes-list li[id^=note_]');
- for (const $noteItem of $notesList) {
- if (Notes.isNodeTypeElement($noteItem)) {
- const noteId = parseInt($noteItem.id.split('_')[1], 10);
- note_ids.push(noteId);
- }
- }
+ static getNotesIds() {
+ /**
+ * The selector covers following notes
+ * - notes and thread below the snippets and commit page
+ * - notes on the file of commit page
+ * - notes on an image file of commit page
+ */
+ const notesList = [...document.querySelectorAll('.notes:not(.notes-form) li[id]')];
+ return notesList.map((noteItem) => parseInt(noteItem.dataset.noteId, 10));
}
/**