fix(chat): exported presentation notification

Adds a specific function to handle the creation of the exported presentatio's
toast notification that were missing.
This commit is contained in:
Arthurk12 2023-12-04 15:41:06 -03:00
parent 3193a40953
commit e4a20aa720
4 changed files with 22 additions and 1 deletions

View File

@ -16,6 +16,7 @@ const CHAT_CONFIG = Meteor.settings.public.chat;
const PUBLIC_CHAT_CLEAR = CHAT_CONFIG.chat_clear; const PUBLIC_CHAT_CLEAR = CHAT_CONFIG.chat_clear;
const PUBLIC_CHAT_ID = CHAT_CONFIG.public_id; const PUBLIC_CHAT_ID = CHAT_CONFIG.public_id;
const POLL_RESULT_KEY = CHAT_CONFIG.system_messages_keys.chat_poll_result; const POLL_RESULT_KEY = CHAT_CONFIG.system_messages_keys.chat_poll_result;
const EXPORTED_PRESENTATION_KEY = CHAT_CONFIG.system_messages_keys.chat_exported_presentation;
const propTypes = { const propTypes = {
pushAlertEnabled: PropTypes.bool.isRequired, pushAlertEnabled: PropTypes.bool.isRequired,
@ -66,6 +67,10 @@ const intlMessages = defineMessages({
id: 'app.toast.chat.pollClick', id: 'app.toast.chat.pollClick',
description: 'chat toast click message for polls', description: 'chat toast click message for polls',
}, },
exportedPresentation: {
id: 'app.toast.chat.exportedPresentation',
description: 'chat toast message for exportedPresentation',
}
}); });
const ALERT_INTERVAL = 5000; // 5 seconds const ALERT_INTERVAL = 5000; // 5 seconds
@ -189,6 +194,13 @@ const ChatAlert = (props) => {
</Styled.PushMessageContent> </Styled.PushMessageContent>
); );
const createExportedPresentationMessage = (filename) => (
<Styled.PushMessageContent>
<Styled.UserNameMessage>{intl.formatMessage(intlMessages.exportedPresentation)}</Styled.UserNameMessage>
<Styled.ContentMessageExportedPresentation>{filename}</Styled.ContentMessageExportedPresentation>
</Styled.PushMessageContent>
);
if (_.isEqual(prevUnreadMessages, unreadMessages)) { if (_.isEqual(prevUnreadMessages, unreadMessages)) {
return null; return null;
} }
@ -203,6 +215,8 @@ const ChatAlert = (props) => {
if (mappedMessage.id.includes(POLL_RESULT_KEY)) { if (mappedMessage.id.includes(POLL_RESULT_KEY)) {
content = createPollMessage(); content = createPollMessage();
isPollResult = true; isPollResult = true;
} else if (mappedMessage.id.includes(EXPORTED_PRESENTATION_KEY)) {
content = createExportedPresentationMessage(mappedMessage.extra.filename);
} else { } else {
content = createMessage(mappedMessage.sender.name, mappedMessage.content.slice(-5)); content = createMessage(mappedMessage.sender.name, mappedMessage.content.slice(-5));
} }

View File

@ -42,9 +42,14 @@ const ContentMessagePoll = styled(ContentMessage)`
margin-top: ${fontSizeSmall}; margin-top: ${fontSizeSmall};
`; `;
const ContentMessageExportedPresentation = styled(ContentMessage)`
margin-top: ${fontSizeSmall};
`;
export default { export default {
PushMessageContent, PushMessageContent,
UserNameMessage, UserNameMessage,
ContentMessage, ContentMessage,
ContentMessagePoll, ContentMessagePoll,
ContentMessageExportedPresentation,
}; };

View File

@ -75,7 +75,8 @@ const mapGroupMessage = (message) => {
time: message.timestamp || message.time, time: message.timestamp || message.time,
sender: null, sender: null,
key: message.key, key: message.key,
chatId: message.chatId chatId: message.chatId,
extra: message.extra,
}; };
if (message.sender && message.sender !== SYSTEM_CHAT_TYPE) { if (message.sender && message.sender !== SYSTEM_CHAT_TYPE) {

View File

@ -812,6 +812,7 @@
"app.toast.chat.system": "System", "app.toast.chat.system": "System",
"app.toast.chat.poll": "Poll Results", "app.toast.chat.poll": "Poll Results",
"app.toast.chat.pollClick": "Poll results were published. Click here to see.", "app.toast.chat.pollClick": "Poll results were published. Click here to see.",
"app.toast.chat.exportedPresentation": "Presentation file",
"app.toast.clearedEmoji.label": "Emoji status cleared", "app.toast.clearedEmoji.label": "Emoji status cleared",
"app.toast.setEmoji.label": "Emoji status set to {0}", "app.toast.setEmoji.label": "Emoji status set to {0}",
"app.toast.meetingMuteOn.label": "All users have been muted", "app.toast.meetingMuteOn.label": "All users have been muted",