crash on missing topic parameters, ranamed var for clarity

This commit is contained in:
or-else
2022-01-28 10:17:14 -08:00
parent 41bf6f3941
commit 728b3a3a1b
9 changed files with 706 additions and 471 deletions
+4 -5
View File
@@ -35,7 +35,7 @@ class NewTopicView extends React.Component {
super(props);
this.state = {
tabSelected: 'p2p',
tabSelected: 'find',
searchQuery: null
};
@@ -62,7 +62,7 @@ class NewTopicView extends React.Component {
}
handleContactSelected(uid) {
if (this.state.tabSelected == 'p2p') {
if (this.state.tabSelected == 'find') {
HashNavigation.navigateTo(HashNavigation.removeUrlParam(window.location.hash, 'tab'));
this.props.onCreateTopic(uid);
}
@@ -87,8 +87,8 @@ class NewTopicView extends React.Component {
return (
<div className="flex-column">
<ul className="tabbar">
<li className={this.state.tabSelected === "p2p" ? "active" : null}>
<a href="#" data-id="p2p" onClick={this.handleTabClick}>
<li className={this.state.tabSelected === "find" ? "active" : null}>
<a href="#" data-id="find" onClick={this.handleTabClick}>
<FormattedMessage id="tabtitle_find_user" defaultMessage="find"
description="Tab title Find" />
</a>
@@ -116,7 +116,6 @@ class NewTopicView extends React.Component {
onError={this.props.onError} /> :
<div className="flex-column">
<SearchContacts
type="p2p"
placeholder={search_placeholder}
onSearchContacts={this.handleSearchContacts} />
<ContactList
+4 -2
View File
@@ -1235,8 +1235,10 @@ class TinodeWeb extends React.Component {
params.desc = {defacs: {auth: DEFAULT_P2P_ACCESS_MODE}};
} else {
topicName = topicName || this.tinode.newGroupTopicName(isChannel);
params.desc = {public: newTopicParams.public, private: {comment: newTopicParams.private}};
params.tags = newTopicParams.tags;
if (newTopicParams) {
params.desc = {public: newTopicParams.public, private: {comment: newTopicParams.private}};
params.tags = newTopicParams.tags;
}
}
params._topicName = topicName;
this.setState({newTopicParams: params}, () => {this.handleTopicSelected(topicName)});
-1
View File
@@ -1,5 +1,4 @@
import React from 'react';
import { FormattedMessage } from 'react-intl';
import Tinode from 'tinode-sdk';