summaryrefslogtreecommitdiff
path: root/ext/js/background/backend.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/js/background/backend.js')
-rw-r--r--ext/js/background/backend.js20
1 files changed, 5 insertions, 15 deletions
diff --git a/ext/js/background/backend.js b/ext/js/background/backend.js
index 569cb53d..881cd241 100644
--- a/ext/js/background/backend.js
+++ b/ext/js/background/backend.js
@@ -609,10 +609,14 @@ export class Backend {
const valid = isNoteDataValid(note);
+ const noteIds = isDuplicate ? duplicateNoteIds[originalIndices.indexOf(i)] : null;
+ const noteInfos = (fetchAdditionalInfo && noteIds !== null && noteIds.length > 0) ? await this._anki.notesInfo(noteIds) : [];
+
const info = {
canAdd: valid,
valid,
- noteIds: isDuplicate ? duplicateNoteIds[originalIndices.indexOf(i)] : null
+ noteIds: noteIds,
+ noteInfos: noteInfos
};
results.push(info);
@@ -622,20 +626,6 @@ export class Backend {
}
}
- if (cannotAdd.length > 0) {
- const cannotAddNotes = cannotAdd.map(({note}) => note);
- const noteIdsArray = await this._anki.findNoteIds(cannotAddNotes);
- for (let i = 0, ii = Math.min(cannotAdd.length, noteIdsArray.length); i < ii; ++i) {
- const noteIds = noteIdsArray[i];
- if (noteIds.length > 0) {
- cannotAdd[i].info.noteIds = noteIds;
- if (fetchAdditionalInfo) {
- cannotAdd[i].info.noteInfos = await this._anki.notesInfo(noteIds);
- }
- }
- }
- }
-
return results;
}