diff --git a/bigbluebutton-html5/imports/api/chat/server/handlers/chatPublicHistoryClear.js b/bigbluebutton-html5/imports/api/chat/server/handlers/chatPublicHistoryClear.js index 47d861bac4ec979cb0ed8d614ed756842f956826..3f29aab4c1931619204c3d2b3015fbc0c6ff06b6 100644 --- a/bigbluebutton-html5/imports/api/chat/server/handlers/chatPublicHistoryClear.js +++ b/bigbluebutton-html5/imports/api/chat/server/handlers/chatPublicHistoryClear.js @@ -10,19 +10,20 @@ export default function publicHistoryClear({ header }, meetingId) { const SYSTEM_CHAT_TYPE = CHAT_CONFIG.type_system; if (meetingId) { - Chat.remove({ meetingId, toUserId: PUBLIC_CHAT_USERID }, - Logger.info(`Cleared Chats (${meetingId})`)); + Chat.remove( + { meetingId, toUserId: PUBLIC_CHAT_USERID }, + Logger.info(`Cleared Chats (${meetingId})`), + ); addChat(meetingId, { - message: '<b><i>The public chat history was cleared by a moderator</i></b>', + message: CHAT_CONFIG.system_messages_keys.chat_clear, fromTime: new Date().getTime(), toUserId: PUBLIC_CHAT_USERID, toUsername: PUBLIC_CHAT_USERNAME, fromUserId: SYSTEM_CHAT_TYPE, fromUsername: '', fromColor: '', - }, - ); + }); } return null; diff --git a/bigbluebutton-html5/imports/ui/components/chat/container.jsx b/bigbluebutton-html5/imports/ui/components/chat/container.jsx index fcfd36f6fcbac8b9f42cc0bff9dbfbd04da1c397..cbf3dc3de7a9fbe602d240d492cd51e8dcb6fa1d 100644 --- a/bigbluebutton-html5/imports/ui/components/chat/container.jsx +++ b/bigbluebutton-html5/imports/ui/components/chat/container.jsx @@ -6,9 +6,12 @@ import ChatService from './service'; const CHAT_CONFIG = Meteor.settings.public.chat; const PUBLIC_CHAT_KEY = CHAT_CONFIG.public_id; - +const CHAT_CLEAR = CHAT_CONFIG.system_messages_keys.chat_clear; const intlMessages = defineMessages({ + [CHAT_CLEAR]: { + id: 'app.chat.clearedChat', + }, titlePublic: { id: 'app.chat.titlePublic', description: 'Public chat title', @@ -47,6 +50,19 @@ export default injectIntl(createContainer(({ params, intl }) => { const user = ChatService.getUser(chatID, '{{NAME}}'); let partnerIsLoggedOut = false; + messages = messages.map((message) => { + if (message.sender) return message; + + return { + ...message, + content: message.content.map(content => ({ + ...content, + text: content.text in intlMessages ? + intl.formatMessage(intlMessages[content.text]) : content.text, + })), + }; + }); + if (user) { partnerIsLoggedOut = !user.isOnline; @@ -56,24 +72,6 @@ export default injectIntl(createContainer(({ params, intl }) => { title = intl.formatMessage(intlMessages.titlePrivate, { 0: chatUser.name }); chatName = chatUser.name; - - if (!chatUser.isOnline) { - const time = Date.now(); - const id = `partner-disconnected-${time}`; - const messagePartnerLoggedOut = { - id, - content: [{ - id, - text: intl.formatMessage(intlMessages.partnerDisconnected, { 0: chatUser.name }), - time, - }], - time, - sender: null, - }; - - messages.push(messagePartnerLoggedOut); - isChatLocked = true; - } } } diff --git a/bigbluebutton-html5/private/config/public/chat.yaml b/bigbluebutton-html5/private/config/public/chat.yaml index 8b291511391c9e37a0499b45078feb8006f88c53..81bc370d11c44b28707c34f2b75b30e6438a1437 100644 --- a/bigbluebutton-html5/private/config/public/chat.yaml +++ b/bigbluebutton-html5/private/config/public/chat.yaml @@ -17,3 +17,5 @@ chat: storage_key: 'UNREAD_CHATS' # Chat paths path_route: 'users/chat/' + system_messages_keys: + chat_clear: 'PUBLIC_CHAT_CLEAR' diff --git a/bigbluebutton-html5/private/locales/en.json b/bigbluebutton-html5/private/locales/en.json index e77f22eb6617fd8bebe18c1332d489ea1ee7f6bc..a739955ff06d4b445ee606c06e6d6543ed4bacd6 100644 --- a/bigbluebutton-html5/private/locales/en.json +++ b/bigbluebutton-html5/private/locales/en.json @@ -15,6 +15,7 @@ "app.chat.dropdown.save": "Save", "app.chat.label": "Chat", "app.chat.emptyLogLabel": "Chat log empty", + "app.chat.clearedChat": "The public chat history was cleared by a moderator", "app.userList.usersTitle": "Users", "app.userList.participantsTitle": "Participants", "app.userList.messagesTitle": "Messages",