[MM-11487] Add a defensive check for channel obj (#1967)

* [MM-11487] Add a defensive check for channel obj

* Fix review comments

* Add a modal to show feedback to user about failed join

* Fix error message
This commit is contained in:
Sudheer 2018-08-13 18:56:05 +05:30 committed by Elias Nahum
parent 1ec8dd4577
commit f06e90407a
2 changed files with 15 additions and 0 deletions

View file

@ -178,6 +178,20 @@ export default class ChannelSidebar extends Component {
this.closeChannelDrawer();
if (!channel) {
const utils = require('app/utils/general');
const {intl} = this.context;
const unableToJoinMessage = {
id: 'mobile.open_unknown_channel.error',
defaultMessage: "We couldn't join the channel. Please reset the cache and try again.",
};
const erroMessage = {};
utils.alertErrorWithFallback(intl, erroMessage, unableToJoinMessage);
return;
}
setChannelLoading(channel.id !== currentChannelId);
setChannelDisplayName(channel.display_name);
EventEmitter.emit('switch_channel', channel, currentChannelId);

View file

@ -2527,6 +2527,7 @@
"mobile.offlineIndicator.offline": "Cannot connect to the server",
"mobile.open_dm.error": "We couldn't open a direct message with {displayName}. Please check your connection and try again.",
"mobile.open_gm.error": "We couldn't open a group message with those users. Please check your connection and try again.",
"mobile.open_unknown_channel.error": "Unable to join the channel. Please reset the cache and try again.",
"mobile.post.cancel": "Cancel",
"mobile.post.delete_question": "Are you sure you want to delete this post?",
"mobile.post.delete_title": "Delete Post",