feat(quick add magic): allow using the project identifier via quick add magic
Related discussion: https://community.vikunja.io/t/using-shorter-list-names-in-quick-add-magic/895
This commit is contained in:
parent
0d3143d465
commit
9c46d064ac
@ -55,6 +55,15 @@ export const useProjectStore = defineStore('project', () => {
|
|||||||
return typeof project === 'undefined' ? null : project
|
return typeof project === 'undefined' ? null : project
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const findProjectByIdentifier = computed(() => {
|
||||||
|
return (identifier: string) => {
|
||||||
|
const project = Object.values(projects.value).find(p => {
|
||||||
|
return p.identifier.toLowerCase() === identifier.toLowerCase()
|
||||||
|
})
|
||||||
|
return typeof project === 'undefined' ? null : project
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
const searchProject = computed(() => {
|
const searchProject = computed(() => {
|
||||||
return (query: string, includeArchived = false) => {
|
return (query: string, includeArchived = false) => {
|
||||||
@ -205,6 +214,7 @@ export const useProjectStore = defineStore('project', () => {
|
|||||||
|
|
||||||
getChildProjects,
|
getChildProjects,
|
||||||
findProjectByExactname,
|
findProjectByExactname,
|
||||||
|
findProjectByIdentifier,
|
||||||
searchProject,
|
searchProject,
|
||||||
searchSavedFilter,
|
searchSavedFilter,
|
||||||
|
|
||||||
|
@ -370,7 +370,12 @@ export const useTaskStore = defineStore('task', () => {
|
|||||||
// Uses the following ways to get the project id of the new task:
|
// Uses the following ways to get the project id of the new task:
|
||||||
// 1. If specified in quick add magic, look in store if it exists and use it if it does
|
// 1. If specified in quick add magic, look in store if it exists and use it if it does
|
||||||
if (typeof projectName !== 'undefined' && projectName !== null) {
|
if (typeof projectName !== 'undefined' && projectName !== null) {
|
||||||
const project = projectStore.findProjectByExactname(projectName)
|
let project = projectStore.findProjectByExactname(projectName)
|
||||||
|
|
||||||
|
if (project === null) {
|
||||||
|
project = projectStore.findProjectByIdentifier(projectName)
|
||||||
|
}
|
||||||
|
|
||||||
foundProjectId = project === null ? null : project.id
|
foundProjectId = project === null ? null : project.id
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user