From aa5cdb64d1ffe8da4a395d12fe3582273e4c5101 Mon Sep 17 00:00:00 2001 From: Diego Benetti Date: Fri, 12 Apr 2019 16:01:31 -0300 Subject: [PATCH] Service import moved to container --- .../user-options/component.jsx | 34 +++++++++---------- .../user-options/container.jsx | 2 ++ 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/bigbluebutton-html5/imports/ui/components/user-list/user-list-content/user-participants/user-options/component.jsx b/bigbluebutton-html5/imports/ui/components/user-list/user-list-content/user-participants/user-options/component.jsx index bd9fa806ee..fc34c307b7 100755 --- a/bigbluebutton-html5/imports/ui/components/user-list/user-list-content/user-participants/user-options/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/user-list/user-list-content/user-participants/user-options/component.jsx @@ -11,7 +11,6 @@ import DropdownList from '/imports/ui/components/dropdown/list/component'; import DropdownListItem from '/imports/ui/components/dropdown/list/item/component'; import LockViewersContainer from '/imports/ui/components/lock-viewers/container'; import BreakoutRoom from '/imports/ui/components/actions-bar/create-breakout-room/component'; -import userListService from '/imports/ui/components/user-list/service'; import { styles } from './styles'; const propTypes = { @@ -94,21 +93,6 @@ const intlMessages = defineMessages({ }); class UserOptions extends PureComponent { - static onSaveUserNames() { - const link = document.createElement('a'); - const mimeType = 'text/plain'; - - const userNamesObj = userListService.getUsers(); - const userNameListString = Object.keys(userNamesObj) - .map(key => userNamesObj[key].name, []).join('\r\n'); - link.setAttribute('download', `save-users-list-${Date.now()}.txt`); - link.setAttribute( - 'href', - `data: ${mimeType} ;charset=utf-8,${userNameListString}`, - ); - link.dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true, view: window })); - } - constructor(props) { super(props); @@ -129,6 +113,22 @@ class UserOptions extends PureComponent { this.onCreateBreakouts = this.onCreateBreakouts.bind(this); this.onInvitationUsers = this.onInvitationUsers.bind(this); this.renderMenuItems = this.renderMenuItems.bind(this); + this.onSaveUserNames = this.onSaveUserNames.bind(this); + } + + onSaveUserNames() { + const link = document.createElement('a'); + const mimeType = 'text/plain'; + const { userListService } = this.props; + const userNamesObj = userListService.getUsers(); + const userNameListString = Object.keys(userNamesObj) + .map(key => userNamesObj[key].name, []).join('\r\n'); + link.setAttribute('download', `save-users-list-${Date.now()}.txt`); + link.setAttribute( + 'href', + `data: ${mimeType} ;charset=utf-16,${encodeURIComponent(userNameListString)}`, + ); + link.dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true, view: window })); } onActionsShow() { @@ -259,7 +259,7 @@ class UserOptions extends PureComponent { icon="download" label={intl.formatMessage(intlMessages.saveUserNames)} key={this.saveUsersNameId} - onClick={UserOptions.onSaveUserNames} + onClick={this.onSaveUserNames} /> ) : null), diff --git a/bigbluebutton-html5/imports/ui/components/user-list/user-list-content/user-participants/user-options/container.jsx b/bigbluebutton-html5/imports/ui/components/user-list/user-list-content/user-participants/user-options/container.jsx index 472655c338..55f2bf660d 100755 --- a/bigbluebutton-html5/imports/ui/components/user-list/user-list-content/user-participants/user-options/container.jsx +++ b/bigbluebutton-html5/imports/ui/components/user-list/user-list-content/user-participants/user-options/container.jsx @@ -2,6 +2,7 @@ import { withTracker } from 'meteor/react-meteor-data'; import PropTypes from 'prop-types'; import Auth from '/imports/ui/services/auth'; import Service from '/imports/ui/components/actions-bar/service'; +import userListService from '/imports/ui/components/user-list/service'; import UserOptions from './component'; const propTypes = { @@ -39,6 +40,7 @@ const UserOptionsContainer = withTracker((props) => { getBreakouts: Service.getBreakouts, sendInvitation: Service.sendInvitation, getUsersNotAssigned: Service.getUsersNotAssigned, + userListService, }; })(UserOptions);