fix assignment in expression

This commit is contained in:
Ramon Souza 2022-04-18 10:27:46 -03:00
parent 9a8264ec6c
commit 90be7416d7

View File

@ -2,7 +2,7 @@ import React, { PureComponent } from 'react';
import { defineMessages, injectIntl } from 'react-intl'; import { defineMessages, injectIntl } from 'react-intl';
import { withModalMounter } from '/imports/ui/components/common/modal/service'; import { withModalMounter } from '/imports/ui/components/common/modal/service';
import _ from 'lodash'; import _ from 'lodash';
import BBBMenu from "/imports/ui/components/common/menu/component"; import BBBMenu from '/imports/ui/components/common/menu/component';
import Button from '/imports/ui/components/common/button/component'; import Button from '/imports/ui/components/common/button/component';
import { alertScreenReader } from '/imports/utils/dom-utils'; import { alertScreenReader } from '/imports/utils/dom-utils';
@ -64,65 +64,65 @@ class ChatDropdown extends PureComponent {
const clearIcon = 'delete'; const clearIcon = 'delete';
const saveIcon = 'download'; const saveIcon = 'download';
const copyIcon = 'copy'; const copyIcon = 'copy';
this.menuItems = [];
ENABLE_SAVE_AND_COPY_PUBLIC_CHAT
&& (
this.menuItems.push(
{
key: this.actionsKey[0],
icon: saveIcon,
dataTest: "chatSave",
label: intl.formatMessage(intlMessages.save),
onClick: () => {
const link = document.createElement('a');
const mimeType = 'text/plain';
const date = new Date();
const time = `${date.getHours()}-${date.getMinutes()}`;
const dateString = `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}_${time}`;
link.setAttribute('download', `bbb-${meetingName}[public-chat]_${dateString}.txt`);
link.setAttribute(
'href',
`data: ${mimeType} ;charset=utf-8,`
+ `${encodeURIComponent(ChatService.exportChat(timeWindowsValues, users, intl))}`,
);
link.dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true, view: window }));
}
}
)
),
ENABLE_SAVE_AND_COPY_PUBLIC_CHAT
&& (
this.menuItems.push(
{
key: this.actionsKey[1],
icon: copyIcon,
id: "clipboardButton",
dataTest: "chatCopy",
label: intl.formatMessage(intlMessages.copy),
onClick: () => {
let chatHistory = ChatService.exportChat(timeWindowsValues, users, intl);
navigator.clipboard.writeText(chatHistory).then(() => {
alertScreenReader(intl.formatMessage(intlMessages.copySuccess));
}).catch(() => {
alertScreenReader(intl.formatMessage(intlMessages.copyErr));
});
}
}
)
)
if (!meetingIsBreakout && amIModerator && isMeteorConnected) { this.menuItems = [];
this.menuItems.push(
{ if (ENABLE_SAVE_AND_COPY_PUBLIC_CHAT) {
key: this.actionsKey[2], this.menuItems.push(
icon: clearIcon, {
dataTest: "chatClear", key: this.actionsKey[0],
label: intl.formatMessage(intlMessages.clear), icon: saveIcon,
onClick: () => ChatService.clearPublicChatHistory() dataTest: 'chatSave',
} label: intl.formatMessage(intlMessages.save),
) onClick: () => {
} const link = document.createElement('a');
const mimeType = 'text/plain';
const date = new Date();
const time = `${date.getHours()}-${date.getMinutes()}`;
const dateString = `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}_${time}`;
link.setAttribute('download', `bbb-${meetingName}[public-chat]_${dateString}.txt`);
link.setAttribute(
'href',
`data: ${mimeType} ;charset=utf-8,`
+ `${encodeURIComponent(ChatService.exportChat(timeWindowsValues, users, intl))}`,
);
link.dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true, view: window }));
},
},
);
}
if (ENABLE_SAVE_AND_COPY_PUBLIC_CHAT) {
this.menuItems.push(
{
key: this.actionsKey[1],
icon: copyIcon,
id: 'clipboardButton',
dataTest: 'chatCopy',
label: intl.formatMessage(intlMessages.copy),
onClick: () => {
const chatHistory = ChatService.exportChat(timeWindowsValues, users, intl);
navigator.clipboard.writeText(chatHistory).then(() => {
alertScreenReader(intl.formatMessage(intlMessages.copySuccess));
}).catch(() => {
alertScreenReader(intl.formatMessage(intlMessages.copyErr));
});
},
},
);
}
if (!meetingIsBreakout && amIModerator && isMeteorConnected) {
this.menuItems.push(
{
key: this.actionsKey[2],
icon: clearIcon,
dataTest: 'chatClear',
label: intl.formatMessage(intlMessages.clear),
onClick: () => ChatService.clearPublicChatHistory(),
},
);
}
return this.menuItems; return this.menuItems;
} }
@ -136,33 +136,33 @@ class ChatDropdown extends PureComponent {
if (!amIModerator && !ENABLE_SAVE_AND_COPY_PUBLIC_CHAT) return null; if (!amIModerator && !ENABLE_SAVE_AND_COPY_PUBLIC_CHAT) return null;
return ( return (
<> <>
<BBBMenu <BBBMenu
trigger={ trigger={(
<Button <Button
data-test="chatOptionsMenu" data-test="chatOptionsMenu"
icon="more" icon="more"
size="sm" size="sm"
ghost ghost
circle circle
hideLabel hideLabel
color="dark" color="dark"
label={intl.formatMessage(intlMessages.options)} label={intl.formatMessage(intlMessages.options)}
aria-label={intl.formatMessage(intlMessages.options)} aria-label={intl.formatMessage(intlMessages.options)}
onClick={() => null} onClick={() => null}
/> />
} )}
opts={{ opts={{
id: "default-dropdown-menu", id: 'default-dropdown-menu',
keepMounted: true, keepMounted: true,
transitionDuration: 0, transitionDuration: 0,
elevation: 3, elevation: 3,
getContentAnchorEl: null, getContentAnchorEl: null,
fullwidth: "true", fullwidth: 'true',
anchorOrigin: { vertical: 'bottom', horizontal: 'left' }, anchorOrigin: { vertical: 'bottom', horizontal: 'left' },
transformorigin: { vertical: 'bottom', horizontal: 'left' }, transformorigin: { vertical: 'bottom', horizontal: 'left' },
}} }}
actions={this.getAvailableActions()} actions={this.getAvailableActions()}
/> />
</> </>
); );
} }