From d6030afabcdf69c76167fc976f9465e90f94de8e Mon Sep 17 00:00:00 2001 From: John Livingston Date: Mon, 16 Jan 2023 18:04:20 +0100 Subject: [PATCH] ConverseJS: in readonly mode, don't show any info messages (except when disconnected). Related to #111 #133 #134 --- CHANGELOG.md | 1 + conversejs/builtin.ts | 31 +++++++++++++++++++------------ 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7bbf4487..5dfb559e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ If you haven't upgraded to v6.0.0 yet, please read v6.0.0 changelog first. * ConverseJS: Don't send state notifications. #134 * ConverseJS: Don't show join/leave messages. #134 * ConverseJS: remove browser notifications, and browser tab message count. +* ConverseJS: in readonly mode, don't show any info messages (except when disconnected). ### Minor changes and fixes diff --git a/conversejs/builtin.ts b/conversejs/builtin.ts index 1592eea7..88891979 100644 --- a/conversejs/builtin.ts +++ b/conversejs/builtin.ts @@ -133,6 +133,24 @@ window.initConverse = async function initConverse ({ ).toString() } + const mucShowInfoMessages = forceReadonly + ? [ + // in readonly mode, show only following info messages: + '301', '307', '321', '322', '332', '333' // disconnected + ] + : [ + // FIXME: wait for a response here, and rewrite: https://github.com/conversejs/converse.js/issues/3125 + '100', '102', '103', '172', '173', '174', // visibility_changes + '110', // self + '104', '201', // non_privacy_changes + '170', '171', // muc_logging_changes + '210', '303', // nickname_changes + '301', '307', '321', '322', '332', '333', // disconnected + 'owner', 'admin', 'member', 'exadmin', 'exowner', 'exoutcast', 'exmember', // affiliation_changes + // 'entered', 'exited', // join_leave_events + 'op', 'deop', 'voice', 'mute' // role_changes + ] + const params: any = { assets_path: assetsPath, @@ -180,18 +198,7 @@ window.initConverse = async function initConverse ({ render_media: false, // for security reason, and to avoid bugs when image is larger that iframe whitelisted_plugins: ['livechatWindowTitlePlugin', 'livechatViewerModePlugin', 'livechatDisconnectOnUnloadPlugin'], show_retraction_warning: false, // No need to use this warning (except if we open to external clients?) - muc_show_info_messages: [ - // FIXME: wait for a response here, and rewrite: https://github.com/conversejs/converse.js/issues/3125 - '100', '102', '103', '172', '173', '174', // visibility_changes - '110', // self - '104', '201', // non_privacy_changes - '170', '171', // muc_logging_changes - '210', '303', // nickname_changes - '301', '307', '321', '322', '332', '333', // disconnected - 'owner', 'admin', 'member', 'exadmin', 'exowner', 'exoutcast', 'exmember', // affiliation_changes - // 'entered', 'exited', // join_leave_events - 'op', 'deop', 'voice', 'mute' // role_changes - ], + muc_show_info_messages: mucShowInfoMessages, send_chat_state_notifications: false // don't send this for performance reason }