respect nosend in thread replies, respect nohtml in !pm send and thread replies (on sending)
This commit is contained in:
@@ -388,6 +388,7 @@ func (b *Bot) sendHelp(ctx context.Context) {
|
|||||||
b.SendNotice(ctx, evt.RoomID, msg.String())
|
b.SendNotice(ctx, evt.RoomID, msg.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//nolint:gocognit // TODO
|
||||||
func (b *Bot) runSend(ctx context.Context) {
|
func (b *Bot) runSend(ctx context.Context) {
|
||||||
evt := eventFromContext(ctx)
|
evt := eventFromContext(ctx)
|
||||||
if !b.allowSend(evt.Sender, evt.RoomID) {
|
if !b.allowSend(evt.Sender, evt.RoomID) {
|
||||||
@@ -408,7 +409,6 @@ func (b *Bot) runSend(ctx context.Context) {
|
|||||||
b.prefix))
|
b.prefix))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
htmlBody := format.RenderMarkdown(body, true, true).FormattedBody
|
|
||||||
|
|
||||||
cfg, err := b.getRoomSettings(evt.RoomID)
|
cfg, err := b.getRoomSettings(evt.RoomID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -422,6 +422,11 @@ func (b *Bot) runSend(ctx context.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var htmlBody string
|
||||||
|
if !cfg.NoHTML() {
|
||||||
|
htmlBody = format.RenderMarkdown(body, true, true).FormattedBody
|
||||||
|
}
|
||||||
|
|
||||||
tos := strings.Split(to, ",")
|
tos := strings.Split(to, ",")
|
||||||
// validate first
|
// validate first
|
||||||
for _, to := range tos {
|
for _, to := range tos {
|
||||||
|
|||||||
@@ -140,6 +140,9 @@ func (b *Bot) IncomingEmail(ctx context.Context, email *email.Email) error {
|
|||||||
// SendEmailReply sends replies from matrix thread to email thread
|
// SendEmailReply sends replies from matrix thread to email thread
|
||||||
func (b *Bot) SendEmailReply(ctx context.Context) {
|
func (b *Bot) SendEmailReply(ctx context.Context) {
|
||||||
evt := eventFromContext(ctx)
|
evt := eventFromContext(ctx)
|
||||||
|
if !b.allowSend(evt.Sender, evt.RoomID) {
|
||||||
|
return
|
||||||
|
}
|
||||||
cfg, err := b.getRoomSettings(evt.RoomID)
|
cfg, err := b.getRoomSettings(evt.RoomID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
b.Error(ctx, evt.RoomID, "cannot retrieve room settings: %v", err)
|
b.Error(ctx, evt.RoomID, "cannot retrieve room settings: %v", err)
|
||||||
@@ -169,7 +172,10 @@ func (b *Bot) SendEmailReply(ctx context.Context) {
|
|||||||
meta.Subject = strings.SplitN(content.Body, "\n", 1)[0]
|
meta.Subject = strings.SplitN(content.Body, "\n", 1)[0]
|
||||||
}
|
}
|
||||||
body := content.Body
|
body := content.Body
|
||||||
htmlBody := content.FormattedBody
|
var htmlBody string
|
||||||
|
if !cfg.NoHTML() {
|
||||||
|
htmlBody = content.FormattedBody
|
||||||
|
}
|
||||||
|
|
||||||
meta.MessageID = email.MessageID(evt.ID, meta.FromDomain)
|
meta.MessageID = email.MessageID(evt.ID, meta.FromDomain)
|
||||||
meta.References = meta.References + " " + meta.MessageID
|
meta.References = meta.References + " " + meta.MessageID
|
||||||
|
|||||||
Reference in New Issue
Block a user