fix(task): call getting task identifier directly instead of using model function
continuous-integration/drone/push Build is passing Details

This commit is contained in:
kolaente 2023-06-18 18:45:59 +02:00
parent e4504748c4
commit 2006abd0a6
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
2 changed files with 15 additions and 7 deletions

View File

@ -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)

View File

@ -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() {