feat(user): save quick add magic mode in api
This commit is contained in:
@ -71,10 +71,10 @@ import {useBaseStore} from '@/stores/base'
|
||||
import {useProjectStore} from '@/stores/projects'
|
||||
import {useLabelStore} from '@/stores/labels'
|
||||
import {useTaskStore} from '@/stores/tasks'
|
||||
import {useAuthStore} from '@/stores/auth'
|
||||
|
||||
import {getHistory} from '@/modules/projectHistory'
|
||||
import {parseTaskText, PrefixMode, PREFIXES} from '@/modules/parseTaskText'
|
||||
import {getQuickAddMagicMode} from '@/helpers/quickAddMagicMode'
|
||||
import {success} from '@/message'
|
||||
|
||||
import type {ITeam} from '@/modelTypes/ITeam'
|
||||
@ -88,6 +88,7 @@ const baseStore = useBaseStore()
|
||||
const projectStore = useProjectStore()
|
||||
const labelStore = useLabelStore()
|
||||
const taskStore = useTaskStore()
|
||||
const authStore = useAuthStore()
|
||||
|
||||
type DoAction<Type = any> = { type: ACTION_TYPE } & Type
|
||||
|
||||
@ -242,7 +243,7 @@ const hintText = computed(() => {
|
||||
}
|
||||
}
|
||||
const prefixes =
|
||||
PREFIXES[getQuickAddMagicMode()] ?? PREFIXES[PrefixMode.Default]
|
||||
PREFIXES[authStore.settings.frontendSettings.quickAddMagicMode] ?? PREFIXES[PrefixMode.Default]
|
||||
return t('quickActions.hint', prefixes)
|
||||
})
|
||||
|
||||
@ -255,7 +256,7 @@ const availableCmds = computed(() => {
|
||||
return cmds
|
||||
})
|
||||
|
||||
const parsedQuery = computed(() => parseTaskText(query.value, getQuickAddMagicMode()))
|
||||
const parsedQuery = computed(() => parseTaskText(query.value, authStore.settings.frontendSettings.quickAddMagicMode))
|
||||
|
||||
const searchMode = computed(() => {
|
||||
if (query.value === '') {
|
||||
|
@ -116,12 +116,12 @@ async function addTask() {
|
||||
// This allows us to find the tasks with the title they had before being parsed
|
||||
// by quick add magic.
|
||||
const createdTasks: { [key: ITask['title']]: ITask } = {}
|
||||
const tasksToCreate = parseSubtasksViaIndention(newTaskTitle.value)
|
||||
const tasksToCreate = parseSubtasksViaIndention(newTaskTitle.value, authStore.settings.frontendSettings.quickAddMagicMode)
|
||||
|
||||
// We ensure all labels exist prior to passing them down to the create task method
|
||||
// In the store it will only ever see one task at a time so there's no way to reliably
|
||||
// check if a new label was created before (because everything happens async).
|
||||
const allLabels = tasksToCreate.map(({title}) => getLabelsFromPrefix(title) ?? [])
|
||||
const allLabels = tasksToCreate.map(({title}) => getLabelsFromPrefix(title, authStore.settings.frontendSettings.quickAddMagicMode) ?? [])
|
||||
await taskStore.ensureLabelsExist(allLabels.flat())
|
||||
|
||||
const newTasks = tasksToCreate.map(async ({title, project}) => {
|
||||
|
@ -99,11 +99,13 @@ import {ref, computed} from 'vue'
|
||||
|
||||
import BaseButton from '@/components/base/BaseButton.vue'
|
||||
|
||||
import {getQuickAddMagicMode} from '@/helpers/quickAddMagicMode'
|
||||
import {PREFIXES} from '@/modules/parseTaskText'
|
||||
import {useAuthStore} from '@/stores/auth'
|
||||
|
||||
const authStore = useAuthStore()
|
||||
|
||||
const visible = ref(false)
|
||||
const mode = ref(getQuickAddMagicMode())
|
||||
const mode = computed(() => authStore.settings.frontendSettings.quickAddMagicMode)
|
||||
|
||||
defineProps<{
|
||||
highlightHintIcon: boolean,
|
||||
|
Reference in New Issue
Block a user