fix(GODT-2935): Do not allow parentID into drafts

When sending a message ensure that if a ParentID matches a proton
message, it is not a draft. This is not supported by the Proton API.
This commit is contained in:
Leander Beernaert 2023-10-25 16:29:39 +02:00
parent 09ef3b20db
commit d6000d025e
1 changed files with 5 additions and 1 deletions

View File

@ -315,7 +315,11 @@ func getParentID(
switch len(metadata) {
case 1:
// found exactly one parent
parentID = metadata[0].ID
// We can only reference messages that have been sent or received. If this message is a draft
// it needs to be ignored.
if metadata[0].Flags.Has(proton.MessageFlagSent) || metadata[0].Flags.Has(proton.MessageFlagReceived) {
parentID = metadata[0].ID
}
case 0:
// found no parents
default: