feathermost/js/main.js

27 lines
968 B
JavaScript

"use strict";
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; });
updateComposeHeight();
checkScrolledToBottom();
populateServerSelectionList();
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();
});