fix error for METADATA CLEAR

This commit is contained in:
Shivaram Lingamneni 2025-06-15 18:34:49 -04:00
parent 96b9bca2d2
commit cd0b6e3d0a

View file

@ -3112,9 +3112,6 @@ func metadataHandler(server *Server, client *Client, msg ircmsg.Message, rb *Res
subcommand := strings.ToLower(msg.Params[1]) subcommand := strings.ToLower(msg.Params[1])
invalidTarget := func() {
rb.Add(nil, server.name, "FAIL", "METADATA", "INVALID_TARGET", target, client.t("Invalid metadata target"))
}
noKeyPerms := func(key string) { noKeyPerms := func(key string) {
rb.Add(nil, server.name, "FAIL", "METADATA", "KEY_NO_PERMISSION", target, key, client.t("You do not have permission to perform this action")) rb.Add(nil, server.name, "FAIL", "METADATA", "KEY_NO_PERMISSION", target, key, client.t("You do not have permission to perform this action"))
} }
@ -3140,7 +3137,7 @@ func metadataHandler(server *Server, client *Client, msg ircmsg.Message, rb *Res
} }
} }
if targetObj == nil { if targetObj == nil {
invalidTarget() rb.Add(nil, server.name, "FAIL", "METADATA", "INVALID_TARGET", target, client.t("Invalid metadata target"))
return return
} }
@ -3229,7 +3226,7 @@ func metadataHandler(server *Server, client *Client, msg ircmsg.Message, rb *Res
case "clear": case "clear":
if !metadataCanIEditThisTarget(client, targetObj) { if !metadataCanIEditThisTarget(client, targetObj) {
invalidTarget() noKeyPerms("*")
return return
} }