Skip to content

Commit 2a5ca9d

Browse files
authored
Merge pull request element-hq#2443 from vector-im/dbkr/matrix_network_join_button
Fix join button for 'matrix' networks
2 parents 60adbff + 323bd79 commit 2a5ca9d

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/components/structures/RoomDirectory.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,11 @@ module.exports = React.createClass({
503503
// matches this network. We look for a matching protocol
504504
// and the existence of a 'domain' field and if present,
505505
// its value.
506-
if (this.protocols[network_info.protocol].instances.length == 1) {
506+
if (
507+
this.protocols[network_info.protocol] &&
508+
this.protocols[network_info.protocol].instances &&
509+
this.protocols[network_info.protocol].instances.length == 1
510+
) {
507511
const the_instance = this.protocols[network_info.protocol].instances[0];
508512
// If there's only one instance in this protocol, use it
509513
// as long as it has no domain (which we assume to mean it's
@@ -591,10 +595,12 @@ module.exports = React.createClass({
591595
placeholder = this.props.config.networks[this.state.network].example;
592596
}
593597

594-
const showJoinButton = (
595-
this._stringLooksLikeId(this.state.filterString, this.state.network) &&
596-
this._getFieldsForThirdPartyLocation(this.state.filterString, this.state.network)
597-
);
598+
let showJoinButton = this._stringLooksLikeId(this.state.filterString, this.state.network);
599+
if (this.state.network && this.state.network != '_matrix') {
600+
if (this._getFieldsForThirdPartyLocation(this.state.filterString, this.state.network) === null) {
601+
showJoinButton = false;
602+
}
603+
}
598604

599605
const SimpleRoomHeader = sdk.getComponent('rooms.SimpleRoomHeader');
600606
const NetworkDropdown = sdk.getComponent('directory.NetworkDropdown');

0 commit comments

Comments
 (0)