Skip to content

Commit 48bf7d9

Browse files
change name of clear overdue task action
1 parent 5cdc70d commit 48bf7d9

4 files changed

Lines changed: 10 additions & 10 deletions

File tree

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
constants: {},
55
// https://www.amplenote.com/help/developing_amplenote_plugins#noteOption
66
taskOption: {
7-
"Bulk Reset Overdue Tasks": {
7+
"Bulk Actions - Clear Overdue Tasks": {
88
run: async function(app, noteUUID) {
99
try {
1010
const oneHourAgo = Math.floor(Date.now() / 1e3) - 3600;
@@ -64,7 +64,7 @@ Remove from calendar?`;
6464
console.log(` endAt: ${task.endAt}`);
6565
console.log(` hideUntil: ${task.hideUntil}`);
6666
if (task.startAt !== null && task.startAt !== void 0) {
67-
delete updates.startAt;
67+
updates.startAt = null;
6868
}
6969
if (task.endAt !== null && task.endAt !== void 0) {
7070
delete updates.endAt;

lib/plugin.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const plugin = {
22
constants: {},
33
// https://www.amplenote.com/help/developing_amplenote_plugins#noteOption
44
taskOption: {
5-
"Bulk Reset Overdue Tasks": {
5+
"Bulk Actions - Clear Overdue Tasks": {
66
run: async function (app, noteUUID) {
77
try {
88
// Get current time minus 1 hour
@@ -90,7 +90,7 @@ const plugin = {
9090

9191
// Only set fields to null if they exist on the task
9292
if (task.startAt !== null && task.startAt !== undefined) {
93-
delete updates.startAt;
93+
updates.startAt = null;
9494
}
9595
if (task.endAt !== null && task.endAt !== undefined) {
9696
delete updates.endAt;

lib/plugin.test.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ describe("Bulk Task Reset Plugin", () => {
1111
app.getTaskDomains = jest.fn().mockResolvedValue([]);
1212
app.alert = jest.fn();
1313

14-
await plugin.taskOption["Bulk Reset Overdue Tasks"].run(
14+
await plugin.taskOption["Bulk Actions - Clear Overdue Tasks"].run(
1515
app,
1616
"test-note-uuid"
1717
);
@@ -36,7 +36,7 @@ describe("Bulk Task Reset Plugin", () => {
3636

3737
app.alert = jest.fn();
3838

39-
await plugin.taskOption["Bulk Reset Overdue Tasks"].run(
39+
await plugin.taskOption["Bulk Actions - Clear Overdue Tasks"].run(
4040
app,
4141
"test-note-uuid"
4242
);
@@ -66,7 +66,7 @@ describe("Bulk Task Reset Plugin", () => {
6666
.mockResolvedValueOnce(1) // User clicks "Reset All"
6767
.mockResolvedValueOnce(undefined); // Success message
6868

69-
await plugin.taskOption["Bulk Reset Overdue Tasks"].run(
69+
await plugin.taskOption["Bulk Actions - Clear Overdue Tasks"].run(
7070
app,
7171
"test-note-uuid"
7272
);
@@ -93,7 +93,7 @@ describe("Bulk Task Reset Plugin", () => {
9393
expect.any(Object)
9494
);
9595

96-
expect(app.updateTask).toHaveBeenCalledTimes(0);
96+
expect(app.updateTask).toHaveBeenCalledTimes(1);
9797

9898
expect(app.alert).toHaveBeenLastCalledWith("Successfully reset 2 tasks.");
9999
});
@@ -116,7 +116,7 @@ describe("Bulk Task Reset Plugin", () => {
116116
app.updateTask = jest.fn();
117117
app.alert = jest.fn().mockResolvedValue(0); // User clicks "Cancel"
118118

119-
await plugin.taskOption["Bulk Reset Overdue Tasks"].run(
119+
await plugin.taskOption["Bulk Actions - Clear Overdue Tasks"].run(
120120
app,
121121
"test-note-uuid"
122122
);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@
2020
},
2121
"testEnvironment": "jsdom",
2222
"type": "module",
23-
"version": "1.0.1"
23+
"version": "1.0.5"
2424
}

0 commit comments

Comments
 (0)