diff --git a/components/connect-form.js b/components/connect-form.js
index c19a8f8..5ebd382 100644
--- a/components/connect-form.js
+++ b/components/connect-form.js
@@ -9,7 +9,7 @@ export default class ConnectForm extends Component {
rememberMe: false,
username: "",
realname: "",
- autojoin: "",
+ autojoin: true,
};
nickInput = createRef();
@@ -27,7 +27,6 @@ export default class ConnectForm extends Component {
rememberMe: props.params.autoconnect || false,
username: props.params.username || "",
realname: props.params.realname || "",
- autojoin: (props.params.autojoin || []).join(","),
};
}
}
@@ -65,13 +64,9 @@ export default class ConnectForm extends Component {
params.saslExternal = true;
}
- this.state.autojoin.split(",").forEach(function(ch) {
- ch = ch.trim();
- if (!ch) {
- return;
- }
- params.autojoin.push(ch);
- });
+ if (this.state.autojoin) {
+ params.autojoin = this.props.params.autojoin || [];
+ }
this.props.onSubmit(params);
}
@@ -131,22 +126,22 @@ export default class ConnectForm extends Component {
`;
}
- let autojoin = html`
-
-
- `;
-
- // Show autojoin field in advanced options, except if it's pre-filled
- let isAutojoinAdvanced = (this.props.params.autojoin || []).length === 0;
+ let autojoin = null;
+ let channels = this.props.params.autojoin || [];
+ if (channels.length > 0) {
+ let s = channels.length > 1 ? "s" : "";
+ autojoin = html`
+
+
+ `;
+ }
return html`