fix: duplicate general topics in restored notebook

This commit is contained in:
thecodrr
2021-02-13 14:24:02 +05:00
parent 92b8c5b899
commit 9164310e8c

View File

@@ -43,11 +43,15 @@ export default class Notebooks extends Collection {
title: notebook.title,
description: notebook.description,
dateCreated: notebook.dateCreated,
dateEdited: notebook.dateEdited,
pinned: !!notebook.pinned,
topics: notebook.topics || [],
totalNotes: 0,
totalNotes: notebook.totalNotes || 0,
};
if (!oldNotebook) {
if (
!oldNotebook &&
notebook.topics.findIndex((topic) => topic.title === "General") <= -1
) {
notebook.topics.splice(0, 0, "General");
}