bugfixes; email parsing; send emails into matrix rooms; e2e tests
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
|
||||
"github.com/getsentry/sentry-go"
|
||||
"gitlab.com/etke.cc/postmoogle/utils"
|
||||
"maunium.net/go/mautrix/event"
|
||||
"maunium.net/go/mautrix/format"
|
||||
"maunium.net/go/mautrix/id"
|
||||
@@ -23,7 +24,7 @@ func (b *Bot) syncRooms(ctx context.Context) error {
|
||||
for _, roomID := range resp.JoinedRooms {
|
||||
cfg, serr := b.getSettings(span.Context(), roomID)
|
||||
if serr != nil {
|
||||
b.Error(span.Context(), roomID, "cannot get room settings: %v", err)
|
||||
b.log.Warn("cannot get %s settings: %v", roomID, err)
|
||||
continue
|
||||
}
|
||||
if cfg.Mailbox != "" {
|
||||
@@ -48,8 +49,7 @@ func (b *Bot) getMailbox(ctx context.Context, evt *event.Event) {
|
||||
|
||||
cfg, err := b.getSettings(span.Context(), evt.RoomID)
|
||||
if err != nil || cfg == nil {
|
||||
b.Error(span.Context(), evt.RoomID, "cannot get settings: %v", err)
|
||||
return
|
||||
b.log.Warn("cannot get %s settings: %v", evt.RoomID, err)
|
||||
}
|
||||
|
||||
if cfg.Mailbox == "" {
|
||||
@@ -69,6 +69,7 @@ func (b *Bot) setMailbox(ctx context.Context, evt *event.Event, mailbox string)
|
||||
span := sentry.StartSpan(ctx, "http.server", sentry.TransactionName("setMailbox"))
|
||||
defer span.Finish()
|
||||
|
||||
mailbox = utils.Mailbox(mailbox)
|
||||
existingID, ok := b.rooms[mailbox]
|
||||
if ok && existingID != "" && existingID != evt.RoomID {
|
||||
content := format.RenderMarkdown("Mailbox "+mailbox+"@"+b.domain+" already taken", true, true)
|
||||
|
||||
Reference in New Issue
Block a user