From 93c3c5f3a978b9e185c0f25514a997781972090e Mon Sep 17 00:00:00 2001 From: Reinaldo Neto <47038980+reinaldonetof@users.noreply.github.com> Date: Mon, 2 May 2022 20:13:39 -0300 Subject: [PATCH] Chore: Evaluate RoomActionsView - TypeScript (#4148) --- app/definitions/IRoom.ts | 2 ++ app/views/RoomActionsView/index.tsx | 19 +++++++++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/app/definitions/IRoom.ts b/app/definitions/IRoom.ts index cb0106a5..40f9b290 100644 --- a/app/definitions/IRoom.ts +++ b/app/definitions/IRoom.ts @@ -210,6 +210,8 @@ export interface IServerRoom extends IRocketChatRecord { departmentId?: string; livechatData?: any; tags?: string[]; + + isLastOwner?: boolean; } export interface IRoomNotifications { diff --git a/app/views/RoomActionsView/index.tsx b/app/views/RoomActionsView/index.tsx index 2e349bc3..dc1fdac7 100644 --- a/app/views/RoomActionsView/index.tsx +++ b/app/views/RoomActionsView/index.tsx @@ -1,3 +1,4 @@ +/* eslint-disable complexity */ import { Q } from '@nozbe/watermelondb'; import { StackNavigationOptions } from '@react-navigation/stack'; import isEmpty from 'lodash/isEmpty'; @@ -45,6 +46,10 @@ import { import { Services } from '../../lib/services'; import { getSubscriptionByRoomId } from '../../lib/database/services/Subscription'; +interface IOnPressTouch { + (item: { route?: T; params?: ChatsStackParamList[T]; event?: Function }): void; +} + interface IRoomActionsViewProps extends IBaseScreen { userId: string; jitsiEnabled: boolean; @@ -176,7 +181,7 @@ class RoomActionsView extends React.Component { + onPressTouchable: IOnPressTouch = (item: { + route?: keyof ChatsStackParamList; + params?: ChatsStackParamList[keyof ChatsStackParamList]; + event?: Function; + }) => { const { route, event, params } = item; if (route) { /** @@ -640,7 +648,7 @@ class RoomActionsView extends React.Component ({ + const teamChannels = result.rooms.map(r => ({ rid: r._id, name: r.name, teamId: r.teamId, @@ -1090,7 +1098,6 @@ class RoomActionsView extends React.Component this.onPressTouchable({ route: 'CannedResponsesListView', params: { rid, room } })} + onPress={() => this.onPressTouchable({ route: 'CannedResponsesListView', params: { rid } })} left={() => } showActionIndicator />