From 28d7acdf99b9d295d0d7507b65def74b74c93e97 Mon Sep 17 00:00:00 2001 From: Livio Amstutz Date: Fri, 17 Dec 2021 09:31:39 +0100 Subject: [PATCH] fix: template removed events on projections (#2863) --- internal/query/projection/custom_text.go | 3 ++- internal/query/projection/custom_text_test.go | 5 ++--- internal/query/projection/message_text_test.go | 3 +-- internal/query/projection/message_texts.go | 3 ++- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/query/projection/custom_text.go b/internal/query/projection/custom_text.go index a3c609de9..64a9e0b05 100644 --- a/internal/query/projection/custom_text.go +++ b/internal/query/projection/custom_text.go @@ -4,6 +4,7 @@ import ( "context" "github.com/caos/logging" + "github.com/caos/zitadel/internal/errors" "github.com/caos/zitadel/internal/eventstore" "github.com/caos/zitadel/internal/eventstore/handler" @@ -144,6 +145,6 @@ func (p *CustomTextProjection) reduceTemplateRemoved(event eventstore.EventReade []handler.Condition{ handler.NewCond(CustomTextAggregateIDCol, customTextEvent.Aggregate().ID), handler.NewCond(CustomTextTemplateCol, customTextEvent.Template), - handler.NewCond(CustomTextLanguageCol, customTextEvent.Language), + handler.NewCond(CustomTextLanguageCol, customTextEvent.Language.String()), }), nil } diff --git a/internal/query/projection/custom_text_test.go b/internal/query/projection/custom_text_test.go index 88eee0fcb..785009d46 100644 --- a/internal/query/projection/custom_text_test.go +++ b/internal/query/projection/custom_text_test.go @@ -9,7 +9,6 @@ import ( "github.com/caos/zitadel/internal/eventstore/repository" "github.com/caos/zitadel/internal/repository/iam" "github.com/caos/zitadel/internal/repository/org" - "golang.org/x/text/language" ) func TestCustomTextProjection_reduces(t *testing.T) { @@ -122,7 +121,7 @@ func TestCustomTextProjection_reduces(t *testing.T) { expectedArgs: []interface{}{ "agg-id", "InitCode", - language.English, + "en", }, }, }, @@ -229,7 +228,7 @@ func TestCustomTextProjection_reduces(t *testing.T) { expectedArgs: []interface{}{ "agg-id", "InitCode", - language.English, + "en", }, }, }, diff --git a/internal/query/projection/message_text_test.go b/internal/query/projection/message_text_test.go index 0f7f3059d..e49d75d1d 100644 --- a/internal/query/projection/message_text_test.go +++ b/internal/query/projection/message_text_test.go @@ -10,7 +10,6 @@ import ( "github.com/caos/zitadel/internal/eventstore/repository" "github.com/caos/zitadel/internal/repository/iam" "github.com/caos/zitadel/internal/repository/org" - "golang.org/x/text/language" ) func TestMessageTextProjection_reduces(t *testing.T) { @@ -574,7 +573,7 @@ func TestMessageTextProjection_reduces(t *testing.T) { expectedArgs: []interface{}{ "agg-id", "InitCode", - language.English, + "en", }, }, }, diff --git a/internal/query/projection/message_texts.go b/internal/query/projection/message_texts.go index 8f78cd1ef..53219c3c2 100644 --- a/internal/query/projection/message_texts.go +++ b/internal/query/projection/message_texts.go @@ -4,6 +4,7 @@ import ( "context" "github.com/caos/logging" + "github.com/caos/zitadel/internal/domain" "github.com/caos/zitadel/internal/errors" "github.com/caos/zitadel/internal/eventstore" @@ -198,7 +199,7 @@ func (p *MessageTextProjection) reduceTemplateRemoved(event eventstore.EventRead []handler.Condition{ handler.NewCond(MessageTextAggregateIDCol, templateEvent.Aggregate().ID), handler.NewCond(MessageTextTypeCol, templateEvent.Template), - handler.NewCond(MessageTextLanguageCol, templateEvent.Language), + handler.NewCond(MessageTextLanguageCol, templateEvent.Language.String()), }, ), nil }