diff --git a/app/containers/message/interfaces.ts b/app/containers/message/interfaces.ts index b5c2e7c81..6c915e61a 100644 --- a/app/containers/message/interfaces.ts +++ b/app/containers/message/interfaces.ts @@ -1,5 +1,7 @@ import { MarkdownAST } from '@rocket.chat/message-parser'; +export type TMessageType = 'discussion-created' | 'jitsi_call_started'; + export interface IMessageAttachments { attachments: any; timeFormat: string; @@ -140,7 +142,7 @@ export interface IMessageInner IMessageThread, IMessageAttachments, IMessageBroadcast { - type: 'discussion-created' | 'jitsi_call_started' | 'c' | 'd' | 'p' | 'l'; + type: TMessageType; blocks: []; } diff --git a/app/definitions/IThread.ts b/app/definitions/IThread.ts index 14926e891..3edefbcad 100644 --- a/app/definitions/IThread.ts +++ b/app/definitions/IThread.ts @@ -43,7 +43,7 @@ export interface IThread { id: string; msg?: string; t?: SubscriptionType; - rid?: string; + rid: string; _updatedAt?: Date; ts?: Date; u?: IUserMessage; diff --git a/app/stacks/MasterDetailStack/types.ts b/app/stacks/MasterDetailStack/types.ts index 3a05dca2a..50240de7d 100644 --- a/app/stacks/MasterDetailStack/types.ts +++ b/app/stacks/MasterDetailStack/types.ts @@ -58,6 +58,7 @@ export type ModalStackParamList = { }; DiscussionsView: { rid: string; + t: SubscriptionType; }; SearchMessagesView: { rid: string; diff --git a/app/stacks/types.ts b/app/stacks/types.ts index 061e8b374..aef4d9bf3 100644 --- a/app/stacks/types.ts +++ b/app/stacks/types.ts @@ -56,6 +56,7 @@ export type ChatsStackParamList = { }; DiscussionsView: { rid: string; + t: SubscriptionType; }; SearchMessagesView: { rid: string; diff --git a/app/views/DiscussionsView/index.tsx b/app/views/DiscussionsView/index.tsx index 419ecb203..0dc076e97 100644 --- a/app/views/DiscussionsView/index.tsx +++ b/app/views/DiscussionsView/index.tsx @@ -5,7 +5,7 @@ import { useSafeAreaInsets } from 'react-native-safe-area-context'; import { HeaderBackButton, StackNavigationOptions, StackNavigationProp } from '@react-navigation/stack'; import { RouteProp } from '@react-navigation/core'; -import { IApplicationState, SubscriptionType } from '../../definitions'; +import { IApplicationState } from '../../definitions'; import { ChatsStackParamList } from '../../stacks/types'; import ActivityIndicator from '../../containers/ActivityIndicator'; import I18n from '../../i18n'; @@ -36,6 +36,7 @@ interface IDiscussionsViewProps { const DiscussionsView = ({ navigation, route }: IDiscussionsViewProps): JSX.Element => { const rid = route.params?.rid; + const t = route.params?.t; const baseUrl = useSelector((state: IApplicationState) => state.server?.server); const isMasterDetail = useSelector((state: IApplicationState) => state.app?.isMasterDetail); @@ -152,12 +153,14 @@ const DiscussionsView = ({ navigation, route }: IDiscussionsViewProps): JSX.Elem const onDiscussionPress = debounce( (item: TThreadModel) => { - navigation.push('RoomView', { - rid: item.drid!, - prid: item.rid, - name: item.msg, - t: item.rid! === 'GENERAL' ? SubscriptionType.CHANNEL : SubscriptionType.GROUP - }); + if (item.drid && item.t) { + navigation.push('RoomView', { + rid: item.drid, + prid: item.rid, + name: item.msg, + t + }); + } }, 1000, true diff --git a/app/views/RoomActionsView/index.js b/app/views/RoomActionsView/index.js index 7c82672c3..fb5970801 100644 --- a/app/views/RoomActionsView/index.js +++ b/app/views/RoomActionsView/index.js @@ -1017,7 +1017,8 @@ class RoomActionsView extends React.Component { this.onPressTouchable({ route: 'DiscussionsView', params: { - rid + rid, + t } }) }