GODT-2226: Fix moving drafts to trash

Only handle draft updates if the event was a message update. Also
includes Gluon update.
This commit is contained in:
Leander Beernaert
2023-01-12 11:13:06 +01:00
parent 0580842ad2
commit 931ed119bb
6 changed files with 37 additions and 5 deletions

View File

@ -409,8 +409,9 @@ func (user *User) handleMessageEvents(ctx context.Context, messageEvents []proto
}
case proton.EventUpdate, proton.EventUpdateFlags:
// Draft update means to completely remove old message and upload the new data again.
if event.Message.IsDraft() {
// Draft update means to completely remove old message and upload the new data again, but we should
// only do this if the event is of type EventUpdate otherwise label switch operations will not work.
if event.Message.IsDraft() && event.Action == proton.EventUpdate {
if err := user.handleUpdateDraftEvent(
logging.WithLogrusField(ctx, "action", "update draft"),
event,