Strip port from address everywhere on the client

This commit is contained in:
Ken-Håvard Lieng 2016-01-14 04:01:51 +01:00
parent d2284551de
commit f6d13675c3
3 changed files with 163 additions and 149 deletions

File diff suppressed because one or more lines are too long

View File

@ -16,7 +16,7 @@ class Connect extends Component {
e.preventDefault(); e.preventDefault();
const { dispatch } = this.props; const { dispatch } = this.props;
const address = e.target.address.value.trim(); let address = e.target.address.value.trim();
const nick = e.target.nick.value.trim(); const nick = e.target.nick.value.trim();
const channels = e.target.channels.value.split(',').map(s => s.trim()).filter(s => s); const channels = e.target.channels.value.split(',').map(s => s.trim()).filter(s => s);
const opts = { const opts = {
@ -32,6 +32,12 @@ class Connect extends Component {
if (address.indexOf('.') > 0 && nick) { if (address.indexOf('.') > 0 && nick) {
dispatch(serverActions.connect(address, nick, opts)); dispatch(serverActions.connect(address, nick, opts));
const i = address.indexOf(':');
if (i > 0) {
address = address.slice(0, i);
}
dispatch(select(address)); dispatch(select(address));
if (channels.length > 0) { if (channels.length > 0) {

View File

@ -176,7 +176,11 @@ export default createReducer(Map(), {
}, },
[actions.CONNECT](state, action) { [actions.CONNECT](state, action) {
const { server } = action; let { server } = action;
const i = server.indexOf(':');
if (i > 0) {
server = server.slice(0, i);
}
if (!state.has(server)) { if (!state.has(server)) {
return state.set(server, Map()); return state.set(server, Map());
} }