webmail: single db transaction while fetching parsed message

This commit is contained in:
Mechiel Lukkien 2024-04-21 20:45:06 +02:00
parent 8ad32f9ede
commit ed0c520562
No known key found for this signature in database

View file

@ -169,10 +169,8 @@ func (Webmail) ParsedMessage(ctx context.Context, msgID int64) (pm ParsedMessage
log.Check(err, "closing account")
}()
var m store.Message
xdbread(ctx, acc, func(tx *bstore.Tx) {
m = xmessageID(ctx, tx, msgID)
})
m := xmessageID(ctx, tx, msgID)
state := msgState{acc: acc}
defer state.clear()
@ -180,12 +178,10 @@ func (Webmail) ParsedMessage(ctx context.Context, msgID int64) (pm ParsedMessage
xcheckf(ctx, err, "parsing message")
if len(pm.envelope.From) == 1 {
xdbread(ctx, acc, func(tx *bstore.Tx) {
pm.ViewMode, err = fromAddrViewMode(tx, pm.envelope.From[0])
xcheckf(ctx, err, "looking up view mode for from address")
})
}
})
return
}