2020-03-25 17:05:25 +01:00
|
|
|
"use strict";
|
2020-03-24 22:47:39 +01:00
|
|
|
|
2020-03-31 16:55:25 +02:00
|
|
|
byId("server_selection_add").addEventListener("click", e => { e.stopPropagation(); e.preventDefault(); window.location = "#login"; return false; });
|
|
|
|
byId("login").addEventListener("submit", e => { logIn(); e.stopPropagation(); e.preventDefault(); return false; });
|
|
|
|
byId("login_no_button").addEventListener("click", e => { e.stopPropagation(); e.preventDefault(); window.location = "#"; return false; });
|
2020-03-26 23:25:35 +01:00
|
|
|
|
2020-03-29 18:54:49 +02:00
|
|
|
updateComposeHeight();
|
2020-03-30 17:12:07 +02:00
|
|
|
checkScrolledToBottom();
|
2021-02-07 21:10:36 +01:00
|
|
|
|
2020-03-31 12:09:33 +02:00
|
|
|
populateServerSelectionList();
|
2021-02-07 21:10:36 +01:00
|
|
|
|
|
|
|
function fetchUsernames(endpoint) {
|
|
|
|
console.debug(endpoint);
|
|
|
|
const client = createClient(endpoint).users();
|
|
|
|
return client;
|
|
|
|
}
|
|
|
|
|
|
|
|
let users = {};
|
|
|
|
Promise.all(localstorage_credentials.getServers().map(server => server.endpoint).map(fetchUsernames)).then(server_user_data => {
|
|
|
|
for (let user_data of server_user_data) {
|
|
|
|
for (let id of Object.getOwnPropertyNames(user_data)) {
|
|
|
|
const user = user_data[id];
|
|
|
|
users[user.id] = user;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
populateChannelList();
|
|
|
|
});
|