You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-11-26 22:41:17 +02:00
All: Allow deleting and syncing deleted resources
This commit is contained in:
@@ -436,8 +436,8 @@ class Note extends BaseItem {
|
||||
// });
|
||||
// }
|
||||
|
||||
static batchDelete(ids, options = null) {
|
||||
const result = super.batchDelete(ids, options);
|
||||
static async batchDelete(ids, options = null) {
|
||||
const result = await super.batchDelete(ids, options);
|
||||
for (let i = 0; i < ids.length; i++) {
|
||||
ItemChange.add(BaseModel.TYPE_NOTE, ids[i], ItemChange.TYPE_DELETE);
|
||||
|
||||
|
||||
@@ -143,6 +143,19 @@ class Resource extends BaseItem {
|
||||
return url.substr(2);
|
||||
}
|
||||
|
||||
static async batchDelete(ids, options = null) {
|
||||
// For resources, there's not really batch deleting since there's the file data to delete
|
||||
// too, so each is processed one by one with the item being deleted last (since the db
|
||||
// call is the less likely to fail).
|
||||
for (let i = 0; i < ids.length; i++) {
|
||||
const id = ids[i];
|
||||
const resource = await Resource.load(id);
|
||||
const path = Resource.fullPath(resource);
|
||||
await this.fsDriver().remove(path);
|
||||
await super.batchDelete([id], options)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Resource.IMAGE_MAX_DIMENSION = 1920;
|
||||
|
||||
Reference in New Issue
Block a user