From 4ed2d305f00cd008c24be30bb9d62ab9ca065862 Mon Sep 17 00:00:00 2001 From: kolaente Date: Wed, 7 Jun 2023 20:33:18 +0200 Subject: [PATCH] fix(task): don't build partial task identifier --- pkg/models/task_collection_test.go | 6 +++--- pkg/models/tasks.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/models/task_collection_test.go b/pkg/models/task_collection_test.go index 39b051d2e3c..eee0843e865 100644 --- a/pkg/models/task_collection_test.go +++ b/pkg/models/task_collection_test.go @@ -404,7 +404,7 @@ func TestTaskCollection_ReadAll(t *testing.T) { task21 := &Task{ ID: 21, Title: "task #21", - Identifier: "-1", + Identifier: "#1", Index: 1, CreatedByID: 6, CreatedBy: user6, @@ -417,7 +417,7 @@ func TestTaskCollection_ReadAll(t *testing.T) { task22 := &Task{ ID: 22, Title: "task #22", - Identifier: "-1", + Identifier: "#1", Index: 1, CreatedByID: 6, CreatedBy: user6, @@ -430,7 +430,7 @@ func TestTaskCollection_ReadAll(t *testing.T) { task23 := &Task{ ID: 23, Title: "task #23", - Identifier: "-1", + Identifier: "#1", Index: 1, CreatedByID: 6, CreatedBy: user6, diff --git a/pkg/models/tasks.go b/pkg/models/tasks.go index 2c6c8bd368d..0d8559db830 100644 --- a/pkg/models/tasks.go +++ b/pkg/models/tasks.go @@ -579,7 +579,7 @@ func getRemindersForTasks(s *xorm.Session, taskIDs []int64) (reminders []*TaskRe } func (t *Task) setIdentifier(project *Project) { - if project == nil { + if project == nil || (project != nil && project.Identifier == "") { t.Identifier = "#" + strconv.FormatInt(t.Index, 10) return }