GODT-1954: Draft message support

Add special case handling for draft messages so that if a Draft is
updated via an event it is correctly updated on the IMAP client via a
the new `imap.MessageUpdated event`.

This patch also updates Gluon to the latest version.
This commit is contained in:
Jakub
2022-10-31 13:52:11 +01:00
committed by James Houlahan
parent c548ba85fe
commit 1e29a5210f
14 changed files with 286 additions and 53 deletions

View File

@ -18,6 +18,7 @@
package logging
import (
"context"
"fmt"
"io"
"os"
@ -147,3 +148,26 @@ func MatchLogName(name string) bool {
func MatchGUILogName(name string) bool {
return regexp.MustCompile(`^gui_v.*\.log$`).MatchString(name)
}
type logKey string
const logrusFields = logKey("logrus")
func WithLogrusField(ctx context.Context, key string, value interface{}) context.Context {
fields, ok := ctx.Value(logrusFields).(logrus.Fields)
if !ok || fields == nil {
fields = logrus.Fields{}
}
fields[key] = value
return context.WithValue(ctx, logrusFields, fields)
}
func LogFromContext(ctx context.Context) *logrus.Entry {
fields, ok := ctx.Value(logrusFields).(logrus.Fields)
if !ok || fields == nil {
return logrus.WithField("ctx", "empty")
}
return logrus.WithFields(fields)
}