Ajusted multi-user change to the new message format

This commit is contained in:
Oleksandr Zhurbenko 2018-04-11 13:50:00 -07:00
parent 0ae0d56348
commit 68aba8e0a2
3 changed files with 28 additions and 29 deletions

View File

@ -2,7 +2,7 @@ import RedisPubSub from '/imports/startup/server/redis';
import { Meteor } from 'meteor/meteor'; import { Meteor } from 'meteor/meteor';
import { check } from 'meteor/check'; import { check } from 'meteor/check';
export default function changeWhiteboardAccess(credentials, multiUser) { export default function changeWhiteboardAccess(credentials, multiUser, whiteboardId) {
const REDIS_CONFIG = Meteor.settings.private.redis; const REDIS_CONFIG = Meteor.settings.private.redis;
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps; const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
const EVENT_NAME = 'ModifyWhiteboardAccessPubMsg'; const EVENT_NAME = 'ModifyWhiteboardAccessPubMsg';
@ -13,9 +13,11 @@ export default function changeWhiteboardAccess(credentials, multiUser) {
check(requesterUserId, String); check(requesterUserId, String);
check(requesterToken, String); check(requesterToken, String);
check(multiUser, Boolean); check(multiUser, Boolean);
check(whiteboardId, String);
const payload = { const payload = {
multiUser, multiUser,
whiteboardId,
}; };
return RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, requesterUserId, payload); return RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, requesterUserId, payload);

View File

@ -100,7 +100,9 @@ class WhiteboardToolbar extends Component {
// no drawSettings in the sessionStorage - setting default values // no drawSettings in the sessionStorage - setting default values
} else { } else {
// setting default drawing settings if they haven't been set previously // setting default drawing settings if they haven't been set previously
const { annotationSelected, thicknessSelected, colorSelected, fontSizeSelected } = this.state; const {
annotationSelected, thicknessSelected, colorSelected, fontSizeSelected,
} = this.state;
this.props.actions.setInitialWhiteboardToolbarValues( this.props.actions.setInitialWhiteboardToolbarValues(
annotationSelected.value, annotationSelected.value,
thicknessSelected.value * 2, thicknessSelected.value * 2,
@ -218,7 +220,8 @@ class WhiteboardToolbar extends Component {
} }
handleSwitchWhiteboardMode() { handleSwitchWhiteboardMode() {
this.props.actions.changeWhiteboardMode(!this.props.multiUser); const { multiUser, whiteboardId } = this.props;
this.props.actions.changeWhiteboardMode(!multiUser, whiteboardId);
} }
// changes a current selected annotation both in the state and in the session // changes a current selected annotation both in the state and in the session
@ -298,7 +301,7 @@ class WhiteboardToolbar extends Component {
label={intl.formatMessage(intlMessages.toolbarTools)} label={intl.formatMessage(intlMessages.toolbarTools)}
icon={this.state.annotationSelected.icon} icon={this.state.annotationSelected.icon}
onItemClick={this.displaySubMenu} onItemClick={this.displaySubMenu}
objectToReturn={'annotationList'} objectToReturn="annotationList"
onBlur={this.closeSubMenu} onBlur={this.closeSubMenu}
className={cx(styles.toolbarButton, this.state.currentSubmenuOpen === 'annotationList' ? '' : styles.notActive)} className={cx(styles.toolbarButton, this.state.currentSubmenuOpen === 'annotationList' ? '' : styles.notActive)}
> >
@ -326,7 +329,7 @@ class WhiteboardToolbar extends Component {
label={intl.formatMessage(intlMessages.toolbarFontSize)} label={intl.formatMessage(intlMessages.toolbarFontSize)}
customIcon={this.renderFontItemIcon()} customIcon={this.renderFontItemIcon()}
onItemClick={this.displaySubMenu} onItemClick={this.displaySubMenu}
objectToReturn={'fontSizeList'} objectToReturn="fontSizeList"
onBlur={this.closeSubMenu} onBlur={this.closeSubMenu}
className={cx(styles.toolbarButton, this.state.currentSubmenuOpen === 'fontSizeList' ? '' : styles.notActive)} className={cx(styles.toolbarButton, this.state.currentSubmenuOpen === 'fontSizeList' ? '' : styles.notActive)}
> >
@ -370,7 +373,7 @@ class WhiteboardToolbar extends Component {
disabled={this.state.annotationSelected.value === 'hand'} disabled={this.state.annotationSelected.value === 'hand'}
label={intl.formatMessage(intlMessages.toolbarLineThickness)} label={intl.formatMessage(intlMessages.toolbarLineThickness)}
onItemClick={this.displaySubMenu} onItemClick={this.displaySubMenu}
objectToReturn={'thicknessList'} objectToReturn="thicknessList"
onBlur={this.closeSubMenu} onBlur={this.closeSubMenu}
className={cx(styles.toolbarButton, this.state.currentSubmenuOpen === 'thicknessList' ? '' : styles.notActive)} className={cx(styles.toolbarButton, this.state.currentSubmenuOpen === 'thicknessList' ? '' : styles.notActive)}
customIcon={this.renderThicknessItemIcon()} customIcon={this.renderThicknessItemIcon()}
@ -407,7 +410,7 @@ class WhiteboardToolbar extends Component {
attributeType="XML" attributeType="XML"
from={this.state.prevColorSelected.value} from={this.state.prevColorSelected.value}
to={this.state.colorSelected.value} to={this.state.colorSelected.value}
begin={'indefinite'} begin="indefinite"
dur={TRANSITION_DURATION} dur={TRANSITION_DURATION}
repeatCount="0" repeatCount="0"
fill="freeze" fill="freeze"
@ -418,7 +421,7 @@ class WhiteboardToolbar extends Component {
attributeType="XML" attributeType="XML"
from={this.state.prevThicknessSelected.value} from={this.state.prevThicknessSelected.value}
to={this.state.thicknessSelected.value} to={this.state.thicknessSelected.value}
begin={'indefinite'} begin="indefinite"
dur={TRANSITION_DURATION} dur={TRANSITION_DURATION}
repeatCount="0" repeatCount="0"
fill="freeze" fill="freeze"
@ -436,7 +439,7 @@ class WhiteboardToolbar extends Component {
disabled={this.state.annotationSelected.value === 'hand'} disabled={this.state.annotationSelected.value === 'hand'}
label={intl.formatMessage(intlMessages.toolbarLineColor)} label={intl.formatMessage(intlMessages.toolbarLineColor)}
onItemClick={this.displaySubMenu} onItemClick={this.displaySubMenu}
objectToReturn={'colorList'} objectToReturn="colorList"
onBlur={this.closeSubMenu} onBlur={this.closeSubMenu}
className={cx(styles.toolbarButton, this.state.currentSubmenuOpen === 'colorList' ? '' : styles.notActive)} className={cx(styles.toolbarButton, this.state.currentSubmenuOpen === 'colorList' ? '' : styles.notActive)}
customIcon={this.renderColorItemIcon()} customIcon={this.renderColorItemIcon()}
@ -467,7 +470,7 @@ class WhiteboardToolbar extends Component {
attributeType="XML" attributeType="XML"
from={this.state.prevColorSelected.value} from={this.state.prevColorSelected.value}
to={this.state.colorSelected.value} to={this.state.colorSelected.value}
begin={'indefinite'} begin="indefinite"
dur={TRANSITION_DURATION} dur={TRANSITION_DURATION}
repeatCount="0" repeatCount="0"
fill="freeze" fill="freeze"
@ -483,7 +486,7 @@ class WhiteboardToolbar extends Component {
return ( return (
<ToolbarMenuItem <ToolbarMenuItem
label={intl.formatMessage(intlMessages.toolbarUndoAnnotation)} label={intl.formatMessage(intlMessages.toolbarUndoAnnotation)}
icon={'undo'} icon="undo"
onItemClick={this.handleUndo} onItemClick={this.handleUndo}
className={cx(styles.toolbarButton, styles.notActive)} className={cx(styles.toolbarButton, styles.notActive)}
/> />
@ -496,7 +499,7 @@ class WhiteboardToolbar extends Component {
return ( return (
<ToolbarMenuItem <ToolbarMenuItem
label={intl.formatMessage(intlMessages.toolbarClearAnnotations)} label={intl.formatMessage(intlMessages.toolbarClearAnnotations)}
icon={'circle_close'} icon="circle_close"
onItemClick={this.handleClearAll} onItemClick={this.handleClearAll}
className={cx(styles.toolbarButton, styles.notActive)} className={cx(styles.toolbarButton, styles.notActive)}
/> />
@ -568,24 +571,18 @@ WhiteboardToolbar.propTypes = {
annotations: PropTypes.arrayOf(PropTypes.object).isRequired, annotations: PropTypes.arrayOf(PropTypes.object).isRequired,
// defines an array of font-sizes for the Font-size submenu of the text shape // defines an array of font-sizes for the Font-size submenu of the text shape
fontSizes: PropTypes.arrayOf( fontSizes: PropTypes.arrayOf(PropTypes.shape({
PropTypes.shape({ value: PropTypes.number.isRequired,
value: PropTypes.number.isRequired, }).isRequired).isRequired,
}).isRequired,
).isRequired,
// defines an array of colors for the toolbar (color submenu) // defines an array of colors for the toolbar (color submenu)
colors: PropTypes.arrayOf( colors: PropTypes.arrayOf(PropTypes.shape({
PropTypes.shape({ value: PropTypes.string.isRequired,
value: PropTypes.string.isRequired, }).isRequired).isRequired,
}).isRequired,
).isRequired,
// defines an array of thickness values for the toolbar and their corresponding session values // defines an array of thickness values for the toolbar and their corresponding session values
thicknessRadiuses: PropTypes.arrayOf( thicknessRadiuses: PropTypes.arrayOf(PropTypes.shape({
PropTypes.shape({ value: PropTypes.number.isRequired,
value: PropTypes.number.isRequired, }).isRequired).isRequired,
}).isRequired,
).isRequired,
// defines the physical height of the whiteboard // defines the physical height of the whiteboard
height: PropTypes.number.isRequired, height: PropTypes.number.isRequired,

View File

@ -22,8 +22,8 @@ const clearWhiteboard = (whiteboardId) => {
makeCall('clearWhiteboard', whiteboardId); makeCall('clearWhiteboard', whiteboardId);
}; };
const changeWhiteboardMode = (multiUser) => { const changeWhiteboardMode = (multiUser, whiteboardId) => {
makeCall('changeWhiteboardAccess', multiUser); makeCall('changeWhiteboardAccess', multiUser, whiteboardId);
}; };
const setInitialWhiteboardToolbarValues = (tool, thickness, color, fontSize, textShape) => { const setInitialWhiteboardToolbarValues = (tool, thickness, color, fontSize, textShape) => {