mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-21 14:09:34 +01:00
fix: allow changing only metadata for locked notes
This commit is contained in:
@@ -252,15 +252,14 @@ export default class Vault {
|
||||
if (!contentId) throw new Error("Cannot lock note because it is empty.");
|
||||
|
||||
// Case: when note is being newly locked
|
||||
if (!data || !type) {
|
||||
if (note.locked) return;
|
||||
if (!note.locked && (!data || !type)) {
|
||||
let content = await this._db.content.raw(contentId, false);
|
||||
// NOTE:
|
||||
// At this point, the note already has all the attachments extracted
|
||||
// so we should just encrypt it as normal.
|
||||
data = content.data;
|
||||
type = content.type;
|
||||
} else {
|
||||
} else if (data && type) {
|
||||
const content = await this._db.content.extractAttachments({
|
||||
data,
|
||||
type,
|
||||
@@ -270,6 +269,7 @@ export default class Vault {
|
||||
type = content.type;
|
||||
}
|
||||
|
||||
if (data && type)
|
||||
await this._encryptContent(contentId, sessionId, data, type, password);
|
||||
|
||||
return await this._db.notes.add({
|
||||
|
||||
Reference in New Issue
Block a user