changeset 4658:ff68cc37b400

mod_spam_reporting: Make 'reason' text an optional value Enables downstream modules that watch these events to distinguish between no reason given and reason being a literal "no reason given".
author Kim Alvefur <zash@zash.se>
date Wed, 25 Aug 2021 16:32:11 +0200
parents 78ef5d9e2361
children cc8b221f137c
files mod_spam_reporting/mod_spam_reporting.lua
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mod_spam_reporting/mod_spam_reporting.lua	Wed Aug 25 16:31:10 2021 +0200
+++ b/mod_spam_reporting/mod_spam_reporting.lua	Wed Aug 25 16:32:11 2021 +0200
@@ -20,7 +20,7 @@
 			local type = report:get_child("spam") and "spam" or
 				report:get_child("abuse") and "abuse" or
 				"unknown";
-			local reason = report:get_child_text("text") or "no reason given";
+			local reason = report:get_child_text("text");
 			module:log("warn", "Received report of %s from JID '%s', %s", type, jid, reason);
 			module:fire_event(module.name.."/"..type.."-report", {
 				origin = event.origin, stanza = event.stanza, jid = jid,
@@ -35,7 +35,7 @@
 				if report.attr.reason == "urn:xmpp:reporting:spam" then
 					type = "spam";
 				end
-				local reason = report:get_child_text("text") or "no reason given";
+				local reason = report:get_child_text("text");
 				module:log("warn", "Received report of %s from JID '%s', %s", type, jid, reason);
 				module:fire_event(module.name.."/"..type.."-report", {
 					origin = event.origin, stanza = event.stanza, jid = jid,