From dc3eec8b16c9e7f6a075d05628208bcdac0ee702 Mon Sep 17 00:00:00 2001 From: Diego Mello Date: Fri, 28 Aug 2020 10:56:41 -0300 Subject: [PATCH] Remove ee --- app/ee/LICENSE | 43 ----- app/ee/omnichannel/actions/inquiry.js | 55 ------ .../containers/OmnichannelStatus.js | 84 --------- app/ee/omnichannel/lib/index.js | 40 ----- .../omnichannel/lib/subscriptions/inquiry.js | 95 ----------- app/ee/omnichannel/reducers/inquiry.js | 51 ------ app/ee/omnichannel/sagas/inquiry.js | 40 ----- app/ee/omnichannel/selectors/inquiry.js | 8 - app/ee/omnichannel/views/QueueListView.js | 160 ------------------ app/reducers/index.js | 3 - app/sagas/index.js | 5 +- app/sagas/login.js | 17 +- app/sagas/selectServer.js | 3 - app/stacks/InsideStack.js | 7 - app/stacks/MasterDetailStack/index.js | 7 - app/views/RoomView/index.js | 10 +- app/views/RoomsListView/ListHeader/index.js | 19 +-- app/views/RoomsListView/index.js | 51 +----- 18 files changed, 9 insertions(+), 689 deletions(-) delete mode 100644 app/ee/LICENSE delete mode 100644 app/ee/omnichannel/actions/inquiry.js delete mode 100644 app/ee/omnichannel/containers/OmnichannelStatus.js delete mode 100644 app/ee/omnichannel/lib/index.js delete mode 100644 app/ee/omnichannel/lib/subscriptions/inquiry.js delete mode 100644 app/ee/omnichannel/reducers/inquiry.js delete mode 100644 app/ee/omnichannel/sagas/inquiry.js delete mode 100644 app/ee/omnichannel/selectors/inquiry.js delete mode 100644 app/ee/omnichannel/views/QueueListView.js diff --git a/app/ee/LICENSE b/app/ee/LICENSE deleted file mode 100644 index 38288b74c..000000000 --- a/app/ee/LICENSE +++ /dev/null @@ -1,43 +0,0 @@ -The Rocket.Chat Enterprise Edition (EE) license (the "EE License") -Copyright (c) 2015-2020 Rocket.Chat Technologies Corp. - -With regard to the Rocket.Chat Software: - -This software and associated documentation files (the "Software") may only be -used in production, if you (and any entity that you represent) have agreed to, -and are in compliance with, the Rocket.Chat Subscription Terms of Service, -available at https://rocket.chat/terms (the "EE Terms"), or other agreement -governing the use of the Software, as agreed by you and Rocket.Chat, and otherwise -have a valid Rocket.Chat Enterprise Edition subscription for the correct number -of user seats. Subject to the foregoing sentence, you are free to modify this -Software and publish patches to the Software. You agree that Rocket.Chat and/or -its licensors (as applicable) retain all right, title and interest in and to all -such modifications and/or patches, and all such modifications and/or patches may -only be used, copied, modified, displayed, distributed, or otherwise exploited -with a valid Rocket.Chat Enterprise Edition subscription for the correct number -of user seats. Notwithstanding the foregoing, you may copy and modify the Software -for development and testing purposes, without requiring a Subscription. You agree -that Rocket.Chat and/or its licensors (as applicable) retain all right, title and -interest in and to all such modifications. You are not granted any other rights -beyond what is expressly stated herein. Subject to the foregoing, it is forbidden -to copy, merge, publish, distribute, sublicense, and/or sell the Software. - -This EE License applies only to the part of this Software that is not distributed -as part of Rocket.Chat Community Edition (CE). Any part of this Software distributed -as part of Rocket.Chat CE or is served client-side as an image, font, cascading -stylesheet (CSS), file which produces or is compiled, arranged, augmented, or combined -into client-side JavaScript, in whole or in part, is copyrighted under the MIT Expat -license. The full text of this EE License shall be included in all copies or substantial -portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - -For all third-party components incorporated into the Rocket.Chat Software, -those components are licensed under the original license provided by the owner -of the applicable component. \ No newline at end of file diff --git a/app/ee/omnichannel/actions/inquiry.js b/app/ee/omnichannel/actions/inquiry.js deleted file mode 100644 index ef3e88c13..000000000 --- a/app/ee/omnichannel/actions/inquiry.js +++ /dev/null @@ -1,55 +0,0 @@ -import * as types from '../../../actions/actionsTypes'; - -export function inquirySetEnabled(enabled) { - return { - type: types.INQUIRY.SET_ENABLED, - enabled - }; -} - -export function inquiryReset() { - return { - type: types.INQUIRY.RESET - }; -} - -export function inquiryQueueAdd(inquiry) { - return { - type: types.INQUIRY.QUEUE_ADD, - inquiry - }; -} - -export function inquiryQueueUpdate(inquiry) { - return { - type: types.INQUIRY.QUEUE_UPDATE, - inquiry - }; -} - -export function inquiryQueueRemove(inquiryId) { - return { - type: types.INQUIRY.QUEUE_REMOVE, - inquiryId - }; -} - -export function inquiryRequest() { - return { - type: types.INQUIRY.REQUEST - }; -} - -export function inquirySuccess(inquiries) { - return { - type: types.INQUIRY.SUCCESS, - inquiries - }; -} - -export function inquiryFailure(error) { - return { - type: types.INQUIRY.FAILURE, - error - }; -} diff --git a/app/ee/omnichannel/containers/OmnichannelStatus.js b/app/ee/omnichannel/containers/OmnichannelStatus.js deleted file mode 100644 index b0763d76e..000000000 --- a/app/ee/omnichannel/containers/OmnichannelStatus.js +++ /dev/null @@ -1,84 +0,0 @@ -import React, { memo, useState, useEffect } from 'react'; -import { - View, Text, StyleSheet, Switch -} from 'react-native'; -import PropTypes from 'prop-types'; - -import Touch from '../../../utils/touch'; -import { CustomIcon } from '../../../lib/Icons'; -import I18n from '../../../i18n'; -import styles from '../../../views/RoomsListView/styles'; -import { themes, SWITCH_TRACK_COLOR } from '../../../constants/colors'; -import { withTheme } from '../../../theme'; -import UnreadBadge from '../../../presentation/UnreadBadge'; -import RocketChat from '../../../lib/rocketchat'; -import { isOmnichannelStatusAvailable, changeLivechatStatus } from '../lib'; - -const OmnichannelStatus = memo(({ - searching, goQueue, theme, queueSize, inquiryEnabled, user -}) => { - if (searching > 0 || !(RocketChat.isOmnichannelModuleAvailable() && user?.roles?.includes('livechat-agent'))) { - return null; - } - const [status, setStatus] = useState(isOmnichannelStatusAvailable(user)); - - useEffect(() => { - setStatus(isOmnichannelStatusAvailable(user)); - }, [user.statusLivechat]); - - const toggleLivechat = async() => { - try { - setStatus(v => !v); - await changeLivechatStatus(); - } catch { - setStatus(v => !v); - } - }; - - return ( - - - - {I18n.t('Omnichannel')} - {inquiryEnabled - ? ( - - ) - : null} - - - - ); -}); - -OmnichannelStatus.propTypes = { - searching: PropTypes.bool, - goQueue: PropTypes.func, - queueSize: PropTypes.number, - inquiryEnabled: PropTypes.bool, - theme: PropTypes.string, - user: PropTypes.shape({ - roles: PropTypes.array, - statusLivechat: PropTypes.string - }) -}; - -export default withTheme(OmnichannelStatus); diff --git a/app/ee/omnichannel/lib/index.js b/app/ee/omnichannel/lib/index.js deleted file mode 100644 index 7492675eb..000000000 --- a/app/ee/omnichannel/lib/index.js +++ /dev/null @@ -1,40 +0,0 @@ -import subscribeInquiry from './subscriptions/inquiry'; -import RocketChat from '../../../lib/rocketchat'; -import EventEmitter from '../../../utils/events'; - -export const isOmnichannelStatusAvailable = user => user?.statusLivechat === 'available'; - -// RC 0.26.0 -export const changeLivechatStatus = () => RocketChat.methodCallWrapper('livechat:changeLivechatStatus'); - -// RC 2.4.0 -export const getInquiriesQueued = () => RocketChat.sdk.get('livechat/inquiries.queued'); - -// this inquiry is added to the db by the subscriptions stream -// and will be removed by the queue stream -// RC 2.4.0 -export const takeInquiry = inquiryId => RocketChat.methodCallWrapper('livechat:takeInquiry', inquiryId); - -class Omnichannel { - constructor() { - this.inquirySub = null; - EventEmitter.addEventListener('INQUIRY_SUBSCRIBE', this.subscribeInquiry); - EventEmitter.addEventListener('INQUIRY_UNSUBSCRIBE', this.unsubscribeInquiry); - } - - subscribeInquiry = async() => { - console.log('[RCRN] Subscribing to inquiry'); - this.inquirySub = await subscribeInquiry(); - } - - unsubscribeInquiry = () => { - if (this.inquirySub) { - console.log('[RCRN] Unsubscribing from inquiry'); - this.inquirySub.stop(); - this.inquirySub = null; - } - } -} - -// eslint-disable-next-line no-unused-vars -const omnichannel = new Omnichannel(); diff --git a/app/ee/omnichannel/lib/subscriptions/inquiry.js b/app/ee/omnichannel/lib/subscriptions/inquiry.js deleted file mode 100644 index 02eafb8a9..000000000 --- a/app/ee/omnichannel/lib/subscriptions/inquiry.js +++ /dev/null @@ -1,95 +0,0 @@ -import log from '../../../../utils/log'; -import store from '../../../../lib/createStore'; -import RocketChat from '../../../../lib/rocketchat'; -import { - inquiryRequest, - inquiryQueueAdd, - inquiryQueueUpdate, - inquiryQueueRemove -} from '../../actions/inquiry'; - -const removeListener = listener => listener.stop(); - -let connectedListener; -let disconnectedListener; -let queueListener; - -const streamTopic = 'stream-livechat-inquiry-queue-observer'; - -export default function subscribeInquiry() { - const handleConnection = () => { - store.dispatch(inquiryRequest()); - }; - - const handleQueueMessageReceived = (ddpMessage) => { - const [{ type, ...sub }] = ddpMessage.fields.args; - - // added can be ignored, since it is handled by 'changed' event - if (/added/.test(type)) { - return; - } - - // if the sub isn't on the queue anymore - if (sub.status !== 'queued') { - // remove it from the queue - store.dispatch(inquiryQueueRemove(sub._id)); - return; - } - - const { queued } = store.getState().inquiry; - // check if this sub is on the current queue - const idx = queued.findIndex(item => item._id === sub._id); - if (idx >= 0) { - // if it is on the queue let's update - store.dispatch(inquiryQueueUpdate(sub)); - } else { - // if it is not on the queue let's add - store.dispatch(inquiryQueueAdd(sub)); - } - }; - - const stop = () => { - if (connectedListener) { - connectedListener.then(removeListener); - connectedListener = false; - } - if (disconnectedListener) { - disconnectedListener.then(removeListener); - disconnectedListener = false; - } - if (queueListener) { - queueListener.then(removeListener); - queueListener = false; - } - }; - - connectedListener = RocketChat.onStreamData('connected', handleConnection); - disconnectedListener = RocketChat.onStreamData('close', handleConnection); - queueListener = RocketChat.onStreamData(streamTopic, handleQueueMessageReceived); - - try { - const { user } = store.getState().login; - RocketChat.getAgentDepartments(user.id).then((result) => { - if (result.success) { - const { departments } = result; - - if (!departments.length || RocketChat.hasRole('livechat-manager')) { - RocketChat.subscribe(streamTopic, 'public').catch(e => console.log(e)); - } - - const departmentIds = departments.map(({ departmentId }) => departmentId); - departmentIds.forEach((departmentId) => { - // subscribe to all departments of the agent - RocketChat.subscribe(streamTopic, `department/${ departmentId }`).catch(e => console.log(e)); - }); - } - }); - - return { - stop: () => stop() - }; - } catch (e) { - log(e); - return Promise.reject(); - } -} diff --git a/app/ee/omnichannel/reducers/inquiry.js b/app/ee/omnichannel/reducers/inquiry.js deleted file mode 100644 index 156c9633d..000000000 --- a/app/ee/omnichannel/reducers/inquiry.js +++ /dev/null @@ -1,51 +0,0 @@ -import { INQUIRY } from '../../../actions/actionsTypes'; - -const initialState = { - enabled: false, - queued: [], - error: {} -}; - -export default function inquiry(state = initialState, action) { - switch (action.type) { - case INQUIRY.SUCCESS: - return { - ...state, - queued: action.inquiries - }; - case INQUIRY.FAILURE: - return { - ...state, - error: action.error - }; - case INQUIRY.SET_ENABLED: - return { - ...state, - enabled: action.enabled - }; - case INQUIRY.QUEUE_ADD: - return { - ...state, - queued: [...state.queued, action.inquiry] - }; - case INQUIRY.QUEUE_UPDATE: - return { - ...state, - queued: state.queued.map((item) => { - if (item._id === action.inquiry._id) { - return action.inquiry; - } - return item; - }) - }; - case INQUIRY.QUEUE_REMOVE: - return { - ...state, - queued: state.queued.filter(({ _id }) => _id !== action.inquiryId) - }; - case INQUIRY.RESET: - return initialState; - default: - return state; - } -} diff --git a/app/ee/omnichannel/sagas/inquiry.js b/app/ee/omnichannel/sagas/inquiry.js deleted file mode 100644 index 6140e2f65..000000000 --- a/app/ee/omnichannel/sagas/inquiry.js +++ /dev/null @@ -1,40 +0,0 @@ -import { put, takeLatest, select } from 'redux-saga/effects'; - -import * as types from '../../../actions/actionsTypes'; -import RocketChat from '../../../lib/rocketchat'; -import EventEmitter from '../../../utils/events'; -import { inquirySuccess, inquiryFailure, inquirySetEnabled } from '../actions/inquiry'; -import { isOmnichannelStatusAvailable, getInquiriesQueued } from '../lib'; - -const handleRequest = function* handleRequest() { - try { - const routingConfig = yield RocketChat.getRoutingConfig(); - const user = yield select(state => state.login.user); - // if routingConfig showQueue is enabled and omnichannel is enabled - const showQueue = routingConfig.showQueue && isOmnichannelStatusAvailable(user); - - if (showQueue) { - // get all the current chats on the queue - const result = yield getInquiriesQueued(); - if (result.success) { - const { inquiries } = result; - - // subscribe to inquiry queue changes - EventEmitter.emit('INQUIRY_SUBSCRIBE'); - - // put request result on redux state - yield put(inquirySuccess(inquiries)); - } - } - - // set enabled to know if we should show the queue button - yield put(inquirySetEnabled(showQueue)); - } catch (e) { - yield put(inquiryFailure(e)); - } -}; - -const root = function* root() { - yield takeLatest(types.INQUIRY.REQUEST, handleRequest); -}; -export default root; diff --git a/app/ee/omnichannel/selectors/inquiry.js b/app/ee/omnichannel/selectors/inquiry.js deleted file mode 100644 index baeb09ef8..000000000 --- a/app/ee/omnichannel/selectors/inquiry.js +++ /dev/null @@ -1,8 +0,0 @@ -import { createSelector } from 'reselect'; - -const getInquiryQueue = state => state.inquiry.queued; - -export const getInquiryQueueSelector = createSelector( - [getInquiryQueue], - queue => queue -); diff --git a/app/ee/omnichannel/views/QueueListView.js b/app/ee/omnichannel/views/QueueListView.js deleted file mode 100644 index 67ee16009..000000000 --- a/app/ee/omnichannel/views/QueueListView.js +++ /dev/null @@ -1,160 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; -import { FlatList } from 'react-native'; -import { connect } from 'react-redux'; -import isEqual from 'react-fast-compare'; - -import I18n from '../../../i18n'; -import RoomItem, { ROW_HEIGHT } from '../../../presentation/RoomItem'; -import { MAX_SIDEBAR_WIDTH } from '../../../constants/tablet'; -import { isTablet, isIOS } from '../../../utils/deviceInfo'; -import { getUserSelector } from '../../../selectors/login'; -import { withTheme } from '../../../theme'; -import { withDimensions } from '../../../dimensions'; -import SafeAreaView from '../../../containers/SafeAreaView'; -import { themes } from '../../../constants/colors'; -import StatusBar from '../../../containers/StatusBar'; -import { goRoom } from '../../../utils/goRoom'; -import { CloseModalButton } from '../../../containers/HeaderButton'; -import RocketChat from '../../../lib/rocketchat'; -import { logEvent, events } from '../../../utils/log'; -import { getInquiryQueueSelector } from '../selectors/inquiry'; - -const INITIAL_NUM_TO_RENDER = isTablet ? 20 : 12; -const getItemLayout = (data, index) => ({ - length: ROW_HEIGHT, - offset: ROW_HEIGHT * index, - index -}); -const keyExtractor = item => item.rid; - -class QueueListView extends React.Component { - static navigationOptions = ({ navigation, isMasterDetail }) => { - const options = { - title: I18n.t('Queued_chats') - }; - if (isMasterDetail) { - options.headerLeft = () => ; - } - return options; - } - - static propTypes = { - user: PropTypes.shape({ - id: PropTypes.string, - username: PropTypes.string, - token: PropTypes.string - }), - isMasterDetail: PropTypes.bool, - width: PropTypes.number, - queued: PropTypes.array, - server: PropTypes.string, - useRealName: PropTypes.bool, - navigation: PropTypes.object, - theme: PropTypes.string - } - - shouldComponentUpdate(nextProps) { - const { queued } = this.props; - if (!isEqual(nextProps.queued, queued)) { - return true; - } - - return false; - } - - onPressItem = (item = {}) => { - logEvent(events.QL_GO_ROOM); - const { navigation, isMasterDetail } = this.props; - if (isMasterDetail) { - navigation.navigate('DrawerNavigator'); - } else { - navigation.navigate('RoomsListView'); - } - - goRoom({ - item: { - ...item, - // we're calling v as visitor on our mergeSubscriptionsRooms - visitor: item.v - }, - isMasterDetail - }); - }; - - getRoomTitle = item => RocketChat.getRoomTitle(item) - - getRoomAvatar = item => RocketChat.getRoomAvatar(item) - - getUidDirectMessage = room => RocketChat.getUidDirectMessage(room) - - renderItem = ({ item }) => { - const { - user: { - id: userId, - username, - token - }, - server, - useRealName, - theme, - isMasterDetail, - width - } = this.props; - const id = this.getUidDirectMessage(item); - - return ( - - ); - } - - render() { - const { queued, theme } = this.props; - return ( - - - - - ); - } -} - -const mapStateToProps = state => ({ - user: getUserSelector(state), - isMasterDetail: state.app.isMasterDetail, - server: state.server.server, - useRealName: state.settings.UI_Use_Real_Name, - queued: getInquiryQueueSelector(state) -}); -export default connect(mapStateToProps)(withDimensions(withTheme(QueueListView))); diff --git a/app/reducers/index.js b/app/reducers/index.js index d047450a6..ed2322eee 100644 --- a/app/reducers/index.js +++ b/app/reducers/index.js @@ -18,8 +18,6 @@ import inviteLinks from './inviteLinks'; import createDiscussion from './createDiscussion'; import enterpriseModules from './enterpriseModules'; -import inquiry from '../ee/omnichannel/reducers/inquiry'; - export default combineReducers({ settings, login, @@ -38,6 +36,5 @@ export default combineReducers({ usersTyping, inviteLinks, createDiscussion, - inquiry, enterpriseModules }); diff --git a/app/sagas/index.js b/app/sagas/index.js index af339c743..27886be83 100644 --- a/app/sagas/index.js +++ b/app/sagas/index.js @@ -11,8 +11,6 @@ import deepLinking from './deepLinking'; import inviteLinks from './inviteLinks'; import createDiscussion from './createDiscussion'; -import inquiry from '../ee/omnichannel/sagas/inquiry'; - const root = function* root() { yield all([ init(), @@ -25,8 +23,7 @@ const root = function* root() { state(), deepLinking(), inviteLinks(), - createDiscussion(), - inquiry() + createDiscussion() ]); }; diff --git a/app/sagas/login.js b/app/sagas/login.js index d1a6a5b50..e969e23e2 100644 --- a/app/sagas/login.js +++ b/app/sagas/login.js @@ -26,9 +26,6 @@ import { localAuthenticate } from '../utils/localAuthentication'; import { setActiveUsers } from '../actions/activeUsers'; import UserPreferences from '../lib/userPreferences'; -import { inquiryRequest, inquiryReset } from '../ee/omnichannel/actions/inquiry'; -import { isOmnichannelStatusAvailable } from '../ee/omnichannel/lib'; - const getServer = state => state.server.server; const loginWithPasswordCall = args => RocketChat.loginWithPassword(args); const loginCall = args => RocketChat.login(args); @@ -87,12 +84,8 @@ const fetchUsersPresence = function* fetchUserPresence() { RocketChat.subscribeUsersPresence(); }; -const fetchEnterpriseModules = function* fetchEnterpriseModules({ user }) { +const fetchEnterpriseModules = function* fetchEnterpriseModules() { yield RocketChat.getEnterpriseModules(); - - if (isOmnichannelStatusAvailable(user) && RocketChat.isOmnichannelModuleAvailable()) { - yield put(inquiryRequest()); - } }; const handleLoginSuccess = function* handleLoginSuccess({ user }) { @@ -221,14 +214,6 @@ const handleSetUser = function* handleSetUser({ user }) { const userId = yield select(state => state.login.user.id); yield put(setActiveUsers({ [userId]: user })); } - - if (user?.statusLivechat && RocketChat.isOmnichannelModuleAvailable()) { - if (isOmnichannelStatusAvailable(user)) { - yield put(inquiryRequest()); - } else { - yield put(inquiryReset()); - } - } }; const root = function* root() { diff --git a/app/sagas/selectServer.js b/app/sagas/selectServer.js index 3b777777a..8243f8464 100644 --- a/app/sagas/selectServer.js +++ b/app/sagas/selectServer.js @@ -19,8 +19,6 @@ import { BASIC_AUTH_KEY, setBasicAuth } from '../utils/fetch'; import { appStart, ROOT_INSIDE, ROOT_OUTSIDE } from '../actions/app'; import UserPreferences from '../lib/userPreferences'; -import { inquiryReset } from '../ee/omnichannel/actions/inquiry'; - const getServerInfo = function* getServerInfo({ server, raiseError = true }) { try { const serverInfo = yield RocketChat.getServerInfo(server); @@ -66,7 +64,6 @@ const getServerInfo = function* getServerInfo({ server, raiseError = true }) { const handleSelectServer = function* handleSelectServer({ server, version, fetchVersion }) { try { - yield put(inquiryReset()); const serversDB = database.servers; yield UserPreferences.setStringAsync(RocketChat.CURRENT_SERVER, server); const userId = yield UserPreferences.getStringAsync(`${ RocketChat.TOKEN_KEY }-${ server }`); diff --git a/app/stacks/InsideStack.js b/app/stacks/InsideStack.js index 82e9f8ad4..08b73d4eb 100644 --- a/app/stacks/InsideStack.js +++ b/app/stacks/InsideStack.js @@ -58,8 +58,6 @@ import StatusView from '../views/StatusView'; import ShareView from '../views/ShareView'; import CreateDiscussionView from '../views/CreateDiscussionView'; -import QueueListView from '../ee/omnichannel/views/QueueListView'; - // ChatsStackNavigator const ChatsStack = createStackNavigator(); const ChatsStackNavigator = () => { @@ -167,11 +165,6 @@ const ChatsStackNavigator = () => { component={ReadReceiptsView} options={ReadReceiptsView.navigationOptions} /> - ); }; diff --git a/app/stacks/MasterDetailStack/index.js b/app/stacks/MasterDetailStack/index.js index bf97cd2ac..e9fa3f60b 100644 --- a/app/stacks/MasterDetailStack/index.js +++ b/app/stacks/MasterDetailStack/index.js @@ -54,8 +54,6 @@ import CreateDiscussionView from '../../views/CreateDiscussionView'; import { setKeyCommands, deleteKeyCommands } from '../../commands'; import ShareView from '../../views/ShareView'; -import QueueListView from '../../ee/omnichannel/views/QueueListView'; - // ChatsStackNavigator const ChatsStack = createStackNavigator(); const ChatsStackNavigator = React.memo(() => { @@ -154,11 +152,6 @@ const ModalStackNavigator = React.memo(({ navigation }) => { component={DirectoryView} options={props => DirectoryView.navigationOptions({ ...props, isMasterDetail: true })} /> - QueueListView.navigationOptions({ ...props, isMasterDetail: true })} - /> { logEvent(events.ROOM_JOIN); try { - const { room } = this.state; - - if (this.isOmnichannel) { - await takeInquiry(room._id); - } else { - await RocketChat.joinRoom(this.rid, this.t); - } + await RocketChat.joinRoom(this.rid, this.t); this.internalSetState({ joined: true }); diff --git a/app/views/RoomsListView/ListHeader/index.js b/app/views/RoomsListView/ListHeader/index.js index 0ce38d079..8718fb524 100644 --- a/app/views/RoomsListView/ListHeader/index.js +++ b/app/views/RoomsListView/ListHeader/index.js @@ -3,31 +3,18 @@ import PropTypes from 'prop-types'; import Sort from './Sort'; -import OmnichannelStatus from '../../../ee/omnichannel/containers/OmnichannelStatus'; - const ListHeader = React.memo(({ searching, sortBy, - toggleSort, - goQueue, - queueSize, - inquiryEnabled, - user + toggleSort }) => ( - <> - - - + )); ListHeader.propTypes = { searching: PropTypes.bool, sortBy: PropTypes.string, - toggleSort: PropTypes.func, - goQueue: PropTypes.func, - queueSize: PropTypes.number, - inquiryEnabled: PropTypes.bool, - user: PropTypes.object + toggleSort: PropTypes.func }; export default ListHeader; diff --git a/app/views/RoomsListView/index.js b/app/views/RoomsListView/index.js index 099b94bf1..e99f1a4dc 100644 --- a/app/views/RoomsListView/index.js +++ b/app/views/RoomsListView/index.js @@ -62,10 +62,6 @@ import { goRoom } from '../../utils/goRoom'; import SafeAreaView from '../../containers/SafeAreaView'; import Header, { getHeaderTitlePosition } from '../../containers/Header'; import { withDimensions } from '../../dimensions'; -import { showErrorAlert, showConfirmationAlert } from '../../utils/info'; - -import { getInquiryQueueSelector } from '../../ee/omnichannel/selectors/inquiry'; -import { changeLivechatStatus, isOmnichannelStatusAvailable } from '../../ee/omnichannel/lib'; const INITIAL_NUM_TO_RENDER = isTablet ? 20 : 12; const CHATS_HEADER = 'Chats'; @@ -141,9 +137,7 @@ class RoomsListView extends React.Component { isMasterDetail: PropTypes.bool, rooms: PropTypes.array, width: PropTypes.number, - insets: PropTypes.object, - queueSize: PropTypes.number, - inquiryEnabled: PropTypes.bool + insets: PropTypes.object }; constructor(props) { @@ -696,41 +690,6 @@ class RoomsListView extends React.Component { } }; - goQueue = () => { - logEvent(events.RL_GO_QUEUE); - const { - navigation, isMasterDetail, queueSize, inquiryEnabled, user - } = this.props; - - // if not-available, prompt to change to available - if (!isOmnichannelStatusAvailable(user)) { - showConfirmationAlert({ - message: I18n.t('Omnichannel_enable_alert'), - confirmationText: I18n.t('Yes'), - onPress: async() => { - try { - await changeLivechatStatus(); - } catch { - // Do nothing - } - } - }); - } - - if (!inquiryEnabled) { - return; - } - // prevent navigation to empty list - if (!queueSize) { - return showErrorAlert(I18n.t('Queue_is_empty'), I18n.t('Oops')); - } - if (isMasterDetail) { - navigation.navigate('ModalStackNavigator', { screen: 'QueueListView' }); - } else { - navigation.navigate('QueueListView'); - } - }; - goRoom = ({ item, isMasterDetail }) => { logEvent(events.RL_GO_ROOM); const { item: currentItem } = this.state; @@ -848,7 +807,7 @@ class RoomsListView extends React.Component { renderListHeader = () => { const { searching } = this.state; const { - sortBy, queueSize, inquiryEnabled, user + sortBy, user } = this.props; return ( ); @@ -1026,9 +983,7 @@ const mapStateToProps = state => ({ useRealName: state.settings.UI_Use_Real_Name, appState: state.app.ready && state.app.foreground ? 'foreground' : 'background', StoreLastMessage: state.settings.Store_Last_Message, - rooms: state.room.rooms, - queueSize: getInquiryQueueSelector(state).length, - inquiryEnabled: state.inquiry.enabled + rooms: state.room.rooms }); const mapDispatchToProps = dispatch => ({