3
0
mirror of https://github.com/ergochat/ergo.git synced 2026-01-02 08:17:57 +01:00

REDACT: fix reason handling (#2319)

REDACT without a reason parameter was being relayed with an
empty reason parameter instead; fix this.
This commit is contained in:
Shivaram Lingamneni 2025-12-30 18:41:24 -05:00 committed by GitHub
parent 13653b5202
commit 3179fdffb0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2792,8 +2792,10 @@ func redactHandler(server *Server, client *Client, msg ircmsg.Message, rb *Respo
targetmsgid := msg.Params[1]
//clientOnlyTags := msg.ClientOnlyTags()
var reason string
var reasonPresent bool
if len(msg.Params) > 2 {
reason = msg.Params[2]
reasonPresent = true
}
var members []*Client // members of a channel, or both parties of a PM
var canDelete CanDelete
@ -2867,7 +2869,11 @@ func redactHandler(server *Server, client *Client, msg ircmsg.Message, rb *Respo
for _, member := range members {
for _, session := range member.Sessions() {
if session.capabilities.Has(caps.MessageRedaction) {
session.sendFromClientInternal(false, time, msgid, details.nickMask, details.accountName, isBot, nil, "REDACT", target, targetmsgid, reason)
if reasonPresent {
session.sendFromClientInternal(false, time, msgid, details.nickMask, details.accountName, isBot, nil, "REDACT", target, targetmsgid, reason)
} else {
session.sendFromClientInternal(false, time, msgid, details.nickMask, details.accountName, isBot, nil, "REDACT", target, targetmsgid)
}
} else {
// If we wanted to send a fallback to clients which do not support
// draft/message-redaction, we would do it from here.