From 9f604eca79fae17cbd27d50c2ee36e37224ef1f8 Mon Sep 17 00:00:00 2001 From: kolaente Date: Tue, 18 Jun 2024 15:41:30 +0200 Subject: [PATCH] fix(tasks): clarify usage of repeating modes available in quick add magic. Originally, it was possible to specify repeating intervals for months or years. This was actually misleading because the interval would be converted to seconds under the hood, causing all kinds of problems with leap years and months with 30 vs 31 days. Because of that, the options for month and year were removed in 7746d3916157e43fca7a24e2a768f7fb83136cf1 to make it clear what these actually meant. Now, since we do have a repeating mode "Monthly", this commit changes the behaviour to repeat a task monthly when it was specified as "every month", but only that. All other cases were removed from the docs since they are not actually supported. https://github.com/go-vikunja/vikunja/issues/271 --- frontend/src/components/tasks/partials/QuickAddMagic.vue | 3 --- frontend/src/stores/tasks.ts | 8 +++++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/frontend/src/components/tasks/partials/QuickAddMagic.vue b/frontend/src/components/tasks/partials/QuickAddMagic.vue index 7f3b553d2..c0270e017 100644 --- a/frontend/src/components/tasks/partials/QuickAddMagic.vue +++ b/frontend/src/components/tasks/partials/QuickAddMagic.vue @@ -88,9 +88,6 @@
  • Every week
  • Every 2 weeks
  • Every month
  • -
  • Every 6 months
  • -
  • Every year
  • -
  • Every 2 years
  • diff --git a/frontend/src/stores/tasks.ts b/frontend/src/stores/tasks.ts index 8a55c1065..46dde6ef6 100644 --- a/frontend/src/stores/tasks.ts +++ b/frontend/src/stores/tasks.ts @@ -30,6 +30,8 @@ import ProjectUserService from '@/services/projectUsers' import {useAuthStore} from '@/stores/auth' import {type TaskFilterParams} from '@/services/taskCollection' import {getRandomColorHex} from '@/helpers/color/randomColor' +import {REPEAT_TYPES} from '@/types/IRepeatAfter' +import {TASK_REPEAT_MODES} from '@/types/IRepeatMode' interface MatchedAssignee extends IUser { match: string, @@ -453,7 +455,11 @@ export const useTaskStore = defineStore('task', () => { position, }) task.repeatAfter = parsedTask.repeats - + + if (parsedTask.repeats?.type === REPEAT_TYPES.Months && parsedTask.repeats?.amount === 1) { + task.repeatMode = TASK_REPEAT_MODES.REPEAT_MODE_MONTH + } + const taskService = new TaskService() try { const createdTask = await taskService.create(task)