Fix navigation logic and update interfaces
This commit is contained in:
parent
ce8a208e42
commit
bce775d88d
|
@ -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: [];
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ export interface IThread {
|
|||
id: string;
|
||||
msg?: string;
|
||||
t?: SubscriptionType;
|
||||
rid?: string;
|
||||
rid: string;
|
||||
_updatedAt?: Date;
|
||||
ts?: Date;
|
||||
u?: IUserMessage;
|
||||
|
|
|
@ -58,6 +58,7 @@ export type ModalStackParamList = {
|
|||
};
|
||||
DiscussionsView: {
|
||||
rid: string;
|
||||
t: SubscriptionType;
|
||||
};
|
||||
SearchMessagesView: {
|
||||
rid: string;
|
||||
|
|
|
@ -56,6 +56,7 @@ export type ChatsStackParamList = {
|
|||
};
|
||||
DiscussionsView: {
|
||||
rid: string;
|
||||
t: SubscriptionType;
|
||||
};
|
||||
SearchMessagesView: {
|
||||
rid: string;
|
||||
|
|
|
@ -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) => {
|
||||
if (item.drid && item.t) {
|
||||
navigation.push('RoomView', {
|
||||
rid: item.drid!,
|
||||
rid: item.drid,
|
||||
prid: item.rid,
|
||||
name: item.msg,
|
||||
t: item.rid! === 'GENERAL' ? SubscriptionType.CHANNEL : SubscriptionType.GROUP
|
||||
t
|
||||
});
|
||||
}
|
||||
},
|
||||
1000,
|
||||
true
|
||||
|
|
|
@ -1017,7 +1017,8 @@ class RoomActionsView extends React.Component {
|
|||
this.onPressTouchable({
|
||||
route: 'DiscussionsView',
|
||||
params: {
|
||||
rid
|
||||
rid,
|
||||
t
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue