fix: empty custom text changes push no events (#8054)

# Which Problems Are Solved

If there is no custom text given, the call ends in an internal error as
no events have to be pushed.

# How the Problems Are Solved

If no events have to be pushed, no trying to push an empty list of
events.

# Additional Changes

No additional changes.

# Additional Context

Closes #6954
This commit is contained in:
Stefan Benz 2024-06-17 14:47:38 +02:00 committed by GitHub
parent 7576f09de6
commit 04fc59f538
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 12 additions and 4 deletions

View File

@ -21,6 +21,9 @@ func (c *Commands) SetCustomInstanceLoginText(ctx context.Context, loginText *do
if err != nil {
return nil, err
}
if len(events) == 0 {
return writeModelToObjectDetails(&existingMailText.WriteModel), nil
}
pushedEvents, err := c.eventstore.Push(ctx, events...)
if err != nil {
return nil, err

View File

@ -38,7 +38,6 @@ func TestCommandSide_SetCustomIAMLoginText(t *testing.T) {
eventstore: eventstoreExpect(
t,
expectFilter(),
expectPush(),
),
},
args: args{

View File

@ -21,6 +21,9 @@ func (c *Commands) SetDefaultMessageText(ctx context.Context, instanceID string,
if err != nil {
return nil, err
}
if len(events) == 0 {
return writeModelToObjectDetails(&existingMessageText.WriteModel), nil
}
pushedEvents, err := c.eventstore.Push(ctx, events...)
if err != nil {
return nil, err

View File

@ -54,7 +54,6 @@ func TestCommandSide_SetDefaultMessageText(t *testing.T) {
eventstore: eventstoreExpect(
t,
expectFilter(),
expectPush(),
),
},
args: args{

View File

@ -23,6 +23,9 @@ func (c *Commands) SetOrgLoginText(ctx context.Context, resourceOwner string, lo
if err != nil {
return nil, err
}
if len(events) == 0 {
return writeModelToObjectDetails(&existingLoginText.WriteModel), nil
}
pushedEvents, err := c.eventstore.Push(ctx, events...)
if err != nil {
return nil, err

View File

@ -56,7 +56,6 @@ func TestCommandSide_SetCustomOrgLoginText(t *testing.T) {
eventstore: eventstoreExpect(
t,
expectFilter(),
expectPush(),
),
},
args: args{

View File

@ -23,6 +23,9 @@ func (c *Commands) SetOrgMessageText(ctx context.Context, resourceOwner string,
if err != nil {
return nil, err
}
if len(events) == 0 {
return writeModelToObjectDetails(&existingMessageText.WriteModel), nil
}
pushedEvents, err := c.eventstore.Push(ctx, events...)
if err != nil {
return nil, err

View File

@ -67,7 +67,6 @@ func TestCommandSide_SetCustomMessageText(t *testing.T) {
eventstore: eventstoreExpect(
t,
expectFilter(),
expectPush(),
),
},
args: args{