From 62325de9cd5da5b70987081956a28e7baa907081 Mon Sep 17 00:00:00 2001 From: kolaente Date: Mon, 11 Jul 2022 14:54:33 +0200 Subject: [PATCH] feat: use actual uuids for tasks --- go.mod | 4 ++-- go.sum | 3 ++- pkg/models/tasks.go | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index 2a69fc4f..14e43338 100644 --- a/go.mod +++ b/go.mod @@ -36,8 +36,10 @@ require ( github.com/go-testfixtures/testfixtures/v3 v3.8.0 github.com/golang-jwt/jwt/v4 v4.4.2 github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 + github.com/google/uuid v1.3.0 github.com/iancoleman/strcase v0.2.0 github.com/imdario/mergo v0.3.13 + github.com/jinzhu/copier v0.3.5 github.com/labstack/echo/v4 v4.7.2 github.com/labstack/gommon v0.3.1 github.com/laurent22/ical-go v0.1.1-0.20181107184520-7e5d6ade8eef @@ -99,12 +101,10 @@ require ( github.com/golang-jwt/jwt v3.2.2+incompatible // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/golang/snappy v0.0.4 // indirect - github.com/google/uuid v1.1.2 // indirect github.com/hashicorp/errwrap v1.0.0 // indirect github.com/hashicorp/go-multierror v1.1.0 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/inconshreveable/mousetrap v1.0.0 // indirect - github.com/jinzhu/copier v0.3.5 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/lithammer/shortuuid/v3 v3.0.4 // indirect diff --git a/go.sum b/go.sum index ffc7bae7..aee20bf8 100644 --- a/go.sum +++ b/go.sum @@ -355,8 +355,9 @@ github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.1.2 h1:EVhdT+1Kseyi1/pUmXKaFxYsDNy9RQYkMWRH68J/W7Y= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= +github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0= diff --git a/pkg/models/tasks.go b/pkg/models/tasks.go index dbaf59c3..090fe072 100644 --- a/pkg/models/tasks.go +++ b/pkg/models/tasks.go @@ -17,6 +17,7 @@ package models import ( + "github.com/google/uuid" "math" "regexp" "sort" @@ -31,7 +32,6 @@ import ( "code.vikunja.io/api/pkg/events" "code.vikunja.io/api/pkg/log" "code.vikunja.io/api/pkg/user" - "code.vikunja.io/api/pkg/utils" "code.vikunja.io/web" "github.com/imdario/mergo" "xorm.io/builder" @@ -898,7 +898,7 @@ func createTask(s *xorm.Session, t *Task, a web.Auth, updateAssignees bool) (err // Generate a uuid if we don't already have one if t.UID == "" { - t.UID = utils.MakeRandomString(40) + t.UID = uuid.NewString() } // Get the default bucket and move the task there