diff --git a/bigbluebutton-html5/imports/api/group-chat-msg/server/modifiers/clearGroupChatMsg.js b/bigbluebutton-html5/imports/api/group-chat-msg/server/modifiers/clearGroupChatMsg.js index 3c7ee643f05b2e2a499655c9f9c61c50685617b1..d5fdfe88e5acc2ea989105845983a5fe2d9d9f6f 100644 --- a/bigbluebutton-html5/imports/api/group-chat-msg/server/modifiers/clearGroupChatMsg.js +++ b/bigbluebutton-html5/imports/api/group-chat-msg/server/modifiers/clearGroupChatMsg.js @@ -9,28 +9,30 @@ export default function clearGroupChatMsg(meetingId, chatId) { const CHAT_CLEAR_MESSAGE = CHAT_CONFIG.system_messages_keys.chat_clear; if (chatId) { - GroupChatMsg.remove({ meetingId, chatId }); - Logger.info(`Cleared GroupChatMsg (${meetingId}, ${chatId})`); - const clearMsg = { - color: '0', - timestamp: Date.now(), - correlationId: `${PUBLIC_CHAT_SYSTEM_ID}-${Date.now()}`, - sender: { - id: PUBLIC_CHAT_SYSTEM_ID, - name: '', - }, - message: CHAT_CLEAR_MESSAGE, - }; - return addGroupChatMsg(meetingId, PUBLIC_GROUP_CHAT_ID, clearMsg); + GroupChatMsg.remove({ meetingId, chatId }, () => { + Logger.info(`Cleared GroupChatMsg (${meetingId}, ${chatId})`); + const clearMsg = { + color: '0', + timestamp: Date.now(), + correlationId: `${PUBLIC_CHAT_SYSTEM_ID}-${Date.now()}`, + sender: { + id: PUBLIC_CHAT_SYSTEM_ID, + name: '', + }, + message: CHAT_CLEAR_MESSAGE, + }; + addGroupChatMsg(meetingId, PUBLIC_GROUP_CHAT_ID, clearMsg); + }); + return true; } if (meetingId) { - return GroupChatMsg.remove({ meetingId }, () => { + return GroupChatMsg.remove({ meetingId, chatId: { $eq: 'MAIN-PUBLIC-GROUP-CHAT' } }, () => { Logger.info(`Cleared GroupChatMsg (${meetingId})`); }); } - return GroupChatMsg.remove({}, () => { + return GroupChatMsg.remove({ chatId: { $eq: 'MAIN-PUBLIC-GROUP-CHAT' } }, () => { Logger.info('Cleared GroupChatMsg (all)'); }); }