fix(task): call getting task identifier directly instead of using model function
This commit is contained in:
parent
e4504748c4
commit
2006abd0a6
@ -51,7 +51,7 @@ import {useCopyToClipboard} from '@/composables/useCopyToClipboard'
|
||||
import {useTaskStore} from '@/stores/tasks'
|
||||
|
||||
import type {ITask} from '@/modelTypes/ITask'
|
||||
import {getHexColor} from '@/models/task'
|
||||
import {getHexColor, getTaskIdentifier} from '@/models/task'
|
||||
|
||||
const props = defineProps({
|
||||
task: {
|
||||
@ -79,7 +79,7 @@ async function copyUrl() {
|
||||
const taskStore = useTaskStore()
|
||||
const loading = computed(() => taskStore.isLoading)
|
||||
|
||||
const textIdentifier = computed(() => props.task?.getTextIdentifier() || '')
|
||||
const textIdentifier = computed(() => getTaskIdentifier(props.task))
|
||||
|
||||
// Since loading is global state, this variable ensures we're only showing the saving icon when saving the description.
|
||||
const saving = ref(false)
|
||||
|
@ -46,6 +46,18 @@ export function parseRepeatAfter(repeatAfterSeconds: number): IRepeatAfter {
|
||||
}
|
||||
}
|
||||
|
||||
export function getTaskIdentifier(task: ITask | null | undefined): string {
|
||||
if (task === null || typeof task === 'undefined') {
|
||||
return ''
|
||||
}
|
||||
|
||||
if (task.identifier === '') {
|
||||
return `#${task.identifier}`
|
||||
}
|
||||
|
||||
return task.identifier
|
||||
}
|
||||
|
||||
export default class TaskModel extends AbstractModel<ITask> implements ITask {
|
||||
id = 0
|
||||
title = ''
|
||||
@ -142,11 +154,7 @@ export default class TaskModel extends AbstractModel<ITask> implements ITask {
|
||||
}
|
||||
|
||||
getTextIdentifier() {
|
||||
if (this.identifier === '') {
|
||||
return `#${this.index}`
|
||||
}
|
||||
|
||||
return this.identifier
|
||||
return getTaskIdentifier(this)
|
||||
}
|
||||
|
||||
getHexColor() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user