added rename note bulk action

This commit is contained in:
zadam
2022-06-12 23:29:11 +02:00
parent 7ba619c71d
commit f8fd8e47a9
10 changed files with 141 additions and 7 deletions

View File

@@ -4,6 +4,8 @@ const becca = require("../becca/becca");
const cloningService = require("./cloning");
const branchService = require("./branches");
const utils = require("./utils");
const dayjs = require("dayjs");
const cls = require("./cls.js");
const ACTION_HANDLERS = {
addLabel: (action, note) => {
@@ -30,6 +32,17 @@ const ACTION_HANDLERS = {
relation.markAsDeleted();
}
},
renameNote: (action, note) => {
// "officially" injected value:
// - note
const newTitle = eval('`' + action.newTitle + '`');
if (note.title !== newTitle) {
note.title = newTitle;
note.save();
}
},
renameLabel: (action, note) => {
for (const label of note.getOwnedLabels(action.oldLabelName)) {
// attribute name is immutable, renaming means delete old + create new