mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-09-03 12:41:45 +02:00
fix: unlink attachments pn note delete
This commit is contained in:
@@ -177,7 +177,7 @@ export default class Attachments extends Collection {
|
||||
* Get specified type of attachments of a note
|
||||
* @param {string} noteId
|
||||
* @param {"files"|"images"|"all"} type
|
||||
* @returns
|
||||
* @returns {Array}
|
||||
*/
|
||||
ofNote(noteId, type) {
|
||||
let attachments = [];
|
||||
|
||||
@@ -202,6 +202,15 @@ export default class Notes extends Collection {
|
||||
if (itemData.color) {
|
||||
await this._db.colors.untag(itemData.color, id);
|
||||
}
|
||||
|
||||
const attachments = this._db.attachments.ofNote(itemData.id, "all");
|
||||
for (let attachment of attachments) {
|
||||
await this._db.attachments.delete(
|
||||
attachment.metadata.hash,
|
||||
itemData.id
|
||||
);
|
||||
}
|
||||
|
||||
// await this._collection.removeItem(id);
|
||||
if (moveToTrash) await this._db.trash.add(itemData);
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user