Skip to content

Commit

Permalink
refactor: expect only one recipient with given address in Message.Rep…
Browse files Browse the repository at this point in the history
…laceIdentityAddress
  • Loading branch information
tnotheis committed Jan 23, 2024
1 parent 44b5b38 commit a3c0d86
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions Modules/Messages/src/Messages.Domain/Entities/Message.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,8 @@ public void ReplaceIdentityAddress(IdentityAddress oldIdentityAddress, IdentityA
CreatedBy = newIdentityAddress;
}

var recipients = Recipients.Where(r => r.Address == oldIdentityAddress);
var recipient = Recipients.FirstOrDefault(r => r.Address == oldIdentityAddress);

foreach (var recipient in recipients)
{
recipient.UpdateAddress(newIdentityAddress);
}
recipient?.UpdateAddress(newIdentityAddress);
}
}

0 comments on commit a3c0d86

Please sign in to comment.