respect nosend in thread replies, respect nohtml in !pm send and thread replies (on sending)

This commit is contained in:
Aine
2022-11-21 10:50:06 +02:00
parent 6ddb894577
commit a5edaaea78
2 changed files with 13 additions and 2 deletions

View File

@@ -388,6 +388,7 @@ func (b *Bot) sendHelp(ctx context.Context) {
b.SendNotice(ctx, evt.RoomID, msg.String())
}
//nolint:gocognit // TODO
func (b *Bot) runSend(ctx context.Context) {
evt := eventFromContext(ctx)
if !b.allowSend(evt.Sender, evt.RoomID) {
@@ -408,7 +409,6 @@ func (b *Bot) runSend(ctx context.Context) {
b.prefix))
return
}
htmlBody := format.RenderMarkdown(body, true, true).FormattedBody
cfg, err := b.getRoomSettings(evt.RoomID)
if err != nil {
@@ -422,6 +422,11 @@ func (b *Bot) runSend(ctx context.Context) {
return
}
var htmlBody string
if !cfg.NoHTML() {
htmlBody = format.RenderMarkdown(body, true, true).FormattedBody
}
tos := strings.Split(to, ",")
// validate first
for _, to := range tos {