From e6721b1fa8a17004205236c6dabba53c79389cd5 Mon Sep 17 00:00:00 2001 From: John Livingston Date: Tue, 25 Jun 2024 12:40:00 +0200 Subject: [PATCH] Terms&Conditions (#18) WIP: * fix terms deletion. --- .../mod_muc_peertubelivechat_terms.lua | 4 +++- server/lib/room-channel/room-channel-class.ts | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/prosody-modules/mod_muc_peertubelivechat_terms/mod_muc_peertubelivechat_terms.lua b/prosody-modules/mod_muc_peertubelivechat_terms/mod_muc_peertubelivechat_terms.lua index f45ffe82..7f271258 100644 --- a/prosody-modules/mod_muc_peertubelivechat_terms/mod_muc_peertubelivechat_terms.lua +++ b/prosody-modules/mod_muc_peertubelivechat_terms/mod_muc_peertubelivechat_terms.lua @@ -39,7 +39,9 @@ function get_muc_terms(room) end function set_muc_terms(room, terms) - terms = terms or nil; + if terms == "" then + terms = nil; + end if get_muc_terms(room) == terms then return false; end diff --git a/server/lib/room-channel/room-channel-class.ts b/server/lib/room-channel/room-channel-class.ts index 193d4323..3dbb1eef 100644 --- a/server/lib/room-channel/room-channel-class.ts +++ b/server/lib/room-channel/room-channel-class.ts @@ -356,7 +356,7 @@ class RoomChannel { // This can be done without waiting for the API call to finish, but we don't want to send thousands of // API calls at the same time. So storing data in a map, and we well launch it sequentially at the end prosodyRoomUpdates.set(roomJID, { - livechat_muc_terms: channelConfigurationOptions.terms + livechat_muc_terms: channelConfigurationOptions.terms ?? '' // must pass a string, else wont update }) this.roomConfToUpdate.delete(roomJID)