From 28d73f4c322a64cbeddb6bebb48b8ca3a5ff0004 Mon Sep 17 00:00:00 2001 From: thecodrr Date: Fri, 1 Jan 2021 15:11:02 +0500 Subject: [PATCH] fix: You cannot pin more than 3 notes on unpin --- apps/web/src/stores/note-store.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/web/src/stores/note-store.js b/apps/web/src/stores/note-store.js index 335482144..34f7f5039 100644 --- a/apps/web/src/stores/note-store.js +++ b/apps/web/src/stores/note-store.js @@ -61,11 +61,11 @@ class NoteStore extends BaseStore { pin = async (id) => { // TODO (hack) we probably shouldn't do this here. - if (db.notes.pinned.length >= 3) { + const note = db.notes.note(id); + if (!note.data.pinned && db.notes.pinned.length >= 3) { await showToast("error", "You cannot pin more than 3 notes."); return; } - const note = db.notes.note(id); if (!this._syncEditor(note.id, "pinned", !note.data.pinned)) { await note.pin(); this.refresh();