fix: checks if the room exists before navigating to it (#5278)
* checks if the room exists before navigating to it * Update app/i18n/locales/pt-BR.json Co-authored-by: Diego Mello <diegolmello@gmail.com> --------- Co-authored-by: Diego Mello <diegolmello@gmail.com>
This commit is contained in:
parent
36ca0384b7
commit
bec1bc77c7
|
@ -1,13 +1,17 @@
|
|||
import React from 'react';
|
||||
import { StyleProp, Text, TextStyle } from 'react-native';
|
||||
|
||||
import i18n from '../../i18n';
|
||||
import { themes } from '../../lib/constants';
|
||||
import { useTheme } from '../../theme';
|
||||
import { IUserChannel } from './interfaces';
|
||||
import styles from './styles';
|
||||
import { getSubscriptionByRoomId } from '../../lib/database/services/Subscription';
|
||||
import { useAppSelector } from '../../lib/hooks';
|
||||
import { showErrorAlert } from '../../lib/methods/helpers';
|
||||
import { goRoom } from '../../lib/methods/helpers/goRoom';
|
||||
import { Services } from '../../lib/services';
|
||||
import { useTheme } from '../../theme';
|
||||
import { sendLoadingEvent } from '../Loading';
|
||||
import { IUserChannel } from './interfaces';
|
||||
import styles from './styles';
|
||||
|
||||
interface IHashtag {
|
||||
hashtag: string;
|
||||
|
@ -30,8 +34,16 @@ const Hashtag = React.memo(({ hashtag, channels, navToRoomInfo, style = [] }: IH
|
|||
const room = navParam.rid && (await getSubscriptionByRoomId(navParam.rid));
|
||||
if (room) {
|
||||
goRoom({ item: room, isMasterDetail });
|
||||
} else {
|
||||
navToRoomInfo(navParam);
|
||||
} else if (navParam.rid) {
|
||||
sendLoadingEvent({ visible: true });
|
||||
try {
|
||||
await Services.getRoomInfo(navParam.rid);
|
||||
sendLoadingEvent({ visible: false });
|
||||
navToRoomInfo(navParam);
|
||||
} catch (error) {
|
||||
sendLoadingEvent({ visible: false });
|
||||
showErrorAlert(i18n.t('The_room_does_not_exist'), i18n.t('Room_not_found'));
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -750,6 +750,8 @@
|
|||
"Continue": "Continue",
|
||||
"Message_has_been_shared": "Message has been shared",
|
||||
"No_channels_in_team": "No Channels on this team",
|
||||
"Room_not_found": "Room not found",
|
||||
"The_room_does_not_exist": "The room does not exist or you may not have access permission",
|
||||
"Supported_versions_expired_title": "{{workspace_name}} is running an unsupported version of Rocket.Chat",
|
||||
"Supported_versions_expired_description": "An admin needs to update the workspace to a supported version in order to reenable access from mobile and desktop apps.",
|
||||
"Supported_versions_warning_update_required": "Update required"
|
||||
|
|
|
@ -736,6 +736,9 @@
|
|||
"decline": "Recusar",
|
||||
"accept": "Aceitar",
|
||||
"Incoming_call_from": "Chamada recebida de",
|
||||
"Call_started": "Chamada Iniciada",
|
||||
"Room_not_found": "Sala não encontrada",
|
||||
"The_room_does_not_exist": "A sala não existe ou você pode não ter permissão de acesso",
|
||||
"Call_started": "Chamada iniciada",
|
||||
"Supported_versions_expired_title": "{{workspace_name}} está executando uma versão não suportada do Rocket.Chat",
|
||||
"Supported_versions_expired_description": "Um administrador precisa atualizar o espaço de trabalho para uma versão suportada a fim de reabilitar o acesso a partir de aplicativos móveis e de desktop.",
|
||||
|
|
Loading…
Reference in New Issue