mirror of
https://github.com/zadam/trilium.git
synced 2025-12-23 00:29:59 +01:00
fix(views/table): bulk actions sometimes not working
This commit is contained in:
@@ -3,7 +3,7 @@ import becca from "../../becca/becca.js";
|
||||
import bulkActionService from "../../services/bulk_actions.js";
|
||||
|
||||
function execute(req: Request) {
|
||||
const { noteIds, includeDescendants } = req.body;
|
||||
const { noteIds, includeDescendants, actions } = req.body;
|
||||
if (!Array.isArray(noteIds)) {
|
||||
throw new Error("noteIds must be an array");
|
||||
}
|
||||
@@ -12,7 +12,16 @@ function execute(req: Request) {
|
||||
|
||||
const bulkActionNote = becca.getNoteOrThrow("_bulkAction");
|
||||
|
||||
bulkActionService.executeActionsFromNote(bulkActionNote, affectedNoteIds);
|
||||
if (actions && actions.length > 0) {
|
||||
for (const action of actions) {
|
||||
if (!action.name) {
|
||||
throw new Error("Action must have a name");
|
||||
}
|
||||
}
|
||||
bulkActionService.executeActions(actions, affectedNoteIds);
|
||||
} else {
|
||||
bulkActionService.executeActionsFromNote(bulkActionNote, affectedNoteIds);
|
||||
}
|
||||
}
|
||||
|
||||
function getAffectedNoteCount(req: Request) {
|
||||
|
||||
Reference in New Issue
Block a user