mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-21 22:19:41 +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.");
|
if (!contentId) throw new Error("Cannot lock note because it is empty.");
|
||||||
|
|
||||||
// Case: when note is being newly locked
|
// Case: when note is being newly locked
|
||||||
if (!data || !type) {
|
if (!note.locked && (!data || !type)) {
|
||||||
if (note.locked) return;
|
|
||||||
let content = await this._db.content.raw(contentId, false);
|
let content = await this._db.content.raw(contentId, false);
|
||||||
// NOTE:
|
// NOTE:
|
||||||
// At this point, the note already has all the attachments extracted
|
// At this point, the note already has all the attachments extracted
|
||||||
// so we should just encrypt it as normal.
|
// so we should just encrypt it as normal.
|
||||||
data = content.data;
|
data = content.data;
|
||||||
type = content.type;
|
type = content.type;
|
||||||
} else {
|
} else if (data && type) {
|
||||||
const content = await this._db.content.extractAttachments({
|
const content = await this._db.content.extractAttachments({
|
||||||
data,
|
data,
|
||||||
type,
|
type,
|
||||||
@@ -270,7 +269,8 @@ export default class Vault {
|
|||||||
type = content.type;
|
type = content.type;
|
||||||
}
|
}
|
||||||
|
|
||||||
await this._encryptContent(contentId, sessionId, data, type, password);
|
if (data && type)
|
||||||
|
await this._encryptContent(contentId, sessionId, data, type, password);
|
||||||
|
|
||||||
return await this._db.notes.add({
|
return await this._db.notes.add({
|
||||||
id,
|
id,
|
||||||
|
|||||||
Reference in New Issue
Block a user