changeset 4312:33a41503b9e3

Improve UX by providing defaults users expect
author Seve Ferrer <seve@delape.net>
date Tue, 22 Dec 2020 11:27:20 +0100
parents a6c253bc63a5
children fc5c53d9d340
files mod_muc_inject_mentions/README.markdown mod_muc_inject_mentions/mod_muc_inject_mentions.lua
diffstat 2 files changed, 4 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/mod_muc_inject_mentions/README.markdown	Tue Dec 22 11:18:46 2020 +0100
+++ b/mod_muc_inject_mentions/README.markdown	Tue Dec 22 11:27:20 2020 +0100
@@ -49,7 +49,7 @@
 -- muc_inject_mentions_disabled_rooms = {"room@conferences.server.com"}
 ```
 
-If none or both are found, all rooms in the muc component will have mentions enabled.
+If none of these is set, all rooms in the muc component will have mentions enabled.
 
 
 By default, if a message contains at least one mention,
--- a/mod_muc_inject_mentions/mod_muc_inject_mentions.lua	Tue Dec 22 11:18:46 2020 +0100
+++ b/mod_muc_inject_mentions/mod_muc_inject_mentions.lua	Tue Dec 22 11:27:20 2020 +0100
@@ -115,11 +115,9 @@
 end
 
 local function is_room_eligible(jid)
-    if not enabled_rooms and not disabled_rooms then
-        return true;
-    end
+    if not enabled_rooms and not disabled_rooms then return true; end
 
-    if enabled_rooms and not disabled_rooms then
+    if enabled_rooms then
         for _, _jid in ipairs(enabled_rooms) do
             if _jid == jid then
                 return true
@@ -128,7 +126,7 @@
         return false
     end
 
-    if disabled_rooms and not enabled_rooms then
+    if disabled_rooms then
         for _, _jid in ipairs(disabled_rooms) do
             if _jid == jid then
                 return false
@@ -136,8 +134,6 @@
         end
         return true
     end
-
-    return true
 end
 
 local function has_nick_prefix(body, first)