From 01b9d94dcd374f1822b65d508b4bd1fefb2dcfb2 Mon Sep 17 00:00:00 2001 From: Christophe NINUCCI <36405135+chrnin@users.noreply.github.com> Date: Fri, 9 Jun 2023 09:53:22 +0200 Subject: [PATCH] force un tableau de longueur 0 pour les labels. (#178) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * force un tableau de longueur 0 pour les labels. * préférer la vérification de non-nil au moment de la création de l'objet --------- Co-authored-by: Christophe Ninucci --- pkg/wekan/createCard.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/wekan/createCard.go b/pkg/wekan/createCard.go index bbb71ca9..1296df4f 100644 --- a/pkg/wekan/createCard.go +++ b/pkg/wekan/createCard.go @@ -2,7 +2,6 @@ package wekan import ( "context" - "github.com/jackc/pgx/v5/pgxpool" "github.com/signaux-faibles/libwekan" "github.com/spf13/viper" @@ -29,6 +28,7 @@ func (service wekanService) CreateCard(ctx context.Context, params core.KanbanNe if err != nil { return err } + card, err := buildCard(board, list.ID, swimlane.ID, params.Description, params.Siret, user, etablissement, params.Labels) if err != nil { return err @@ -59,8 +59,9 @@ func buildCard( card.CustomFields = []libwekan.CardCustomField{activiteField, effectifField, contactField, siretField, ficheField} labelIDs := utils.Convert(labels, labelNameToIDConvertor(configBoard)) - card.LabelIDs = labelIDs - + if labelIDs != nil { + card.LabelIDs = labelIDs + } return card, nil }