From 97d4dc9f3bfcc8a422b973c86c09eaa916ac6796 Mon Sep 17 00:00:00 2001 From: Gerzon Z Date: Thu, 14 Apr 2022 17:19:33 -0400 Subject: [PATCH] chore: add omnichannel permissions to RightButtons chore: missing changes to previous commit on RoomView --- app/views/RoomView/RightButtons.tsx | 35 ++++++++++++++++++----------- app/views/RoomView/index.tsx | 16 ++++++++++--- 2 files changed, 35 insertions(+), 16 deletions(-) diff --git a/app/views/RoomView/RightButtons.tsx b/app/views/RoomView/RightButtons.tsx index 55ea27ad0..c3b4588a0 100644 --- a/app/views/RoomView/RightButtons.tsx +++ b/app/views/RoomView/RightButtons.tsx @@ -82,16 +82,7 @@ class RightButtonsContainer extends Component { + const canReturnQueue = await this.canReturnQueue(); + const canForwardGuest = await this.canForwardGuest(); + this.setState({ canReturnQueue, canForwardGuest }); + }; + observeThread = (threadRecord: TMessageModel) => { const threadObservable: Observable = threadRecord.observe(); this.threadSubscription = threadObservable.subscribe(thread => this.updateThread(thread)); @@ -278,13 +283,17 @@ class RightButtonsContainer extends Component { + const { joined, status } = this.props; + return joined && status !== 'queued'; + }; + render() { const { isFollowingThread, tunread, tunreadUser, tunreadGroup } = this.state; - const { t, tmid, threadsEnabled, teamId, joined, status } = this.props; - const isOmnichannelPreview = joined && status !== 'queued'; + const { t, tmid, threadsEnabled, teamId, joined } = this.props; if (t === 'l') { - if (isOmnichannelPreview) { + if (this.isOmnichannelPreview()) { return ( diff --git a/app/views/RoomView/index.tsx b/app/views/RoomView/index.tsx index 13182add2..46c20297d 100644 --- a/app/views/RoomView/index.tsx +++ b/app/views/RoomView/index.tsx @@ -315,7 +315,7 @@ class RoomView extends React.Component { } componentDidUpdate(prevProps: IRoomViewProps, prevState: IRoomViewState) { - const { roomUpdate } = this.state; + const { roomUpdate, joined } = this.state; const { appState, insets, route } = this.props; if (route?.params?.jumpToMessageId && route?.params?.jumpToMessageId !== prevProps.route?.params?.jumpToMessageId) { @@ -341,7 +341,11 @@ class RoomView extends React.Component { } // If it's a livechat room if (this.t === 'l') { - if (!dequal(prevState.roomUpdate.visitor, roomUpdate.visitor)) { + if ( + !dequal(prevState.roomUpdate.visitor, roomUpdate.visitor) || + !dequal(prevState.roomUpdate.status, roomUpdate.status) || + prevState.joined !== joined + ) { this.setHeader(); } } @@ -1146,6 +1150,11 @@ class RoomView extends React.Component { }); }; + goToCannedResponses = () => { + const { room } = this.state; + Navigation.navigate('CannedResponsesListView', { rid: room.rid, room }); + }; + renderItem = (item: TAnyMessageModel, previousItem: TAnyMessageModel, highlightedMessage?: string) => { const { room, lastOpen, canAutoTranslate } = this.state; const { user, Message_GroupingPeriod, Message_TimeFormat, useRealName, baseUrl, Message_Read_Receipt_Enabled, theme } = @@ -1279,6 +1288,7 @@ class RoomView extends React.Component { return ( { if ('id' in room) { ({ sysMes, bannerClosed, announcement, tunread, ignored } = room); } - + console.log({ room }); return (