Search patch and old notification remove

This commit is contained in:
Xamora 2024-05-13 16:44:20 +02:00
parent 17bcee764b
commit 533f0c04f9

View File

@ -25,13 +25,13 @@ export default class extends AbstractView {
let profiles = await client.profiles.all();
//console.log(client.notice.data);
if (client.notice.data == undefined || client.notice.data.online == undefined)
return console.log("Error");
//if (client.notice.data == undefined || client.notice.data.online == undefined)
//return console.log("Error");
//await client.notice.getOnlineUser();
//await this.wait_get_online_users();
client.notice.rewrite_usernames = this.rewrite_usernames;
client.notice.rewrite_invite = this.display_invite;
//client.notice.rewrite_usernames = this.rewrite_usernames;
//client.notice.rewrite_invite = this.display_invite;
let search = document.getElementById("input_user");
if (search != undefined)
@ -54,7 +54,7 @@ export default class extends AbstractView {
let list_users = document.getElementById('list_users');
list_users.innerHTML = "";
profiles.filter(user => user.username.toLowerCase().startsWith(search) == true).forEach((user) => {
profiles.filter(user => user.username.toLowerCase().startsWith(search) == true).forEach(async (user) => {
if (user.id == null) {
console.log("list User one with id null;");
@ -71,8 +71,14 @@ export default class extends AbstractView {
if (logged && user.id == client.me.id)
username.style.color = "green";
else {
let online = client.notice.data.online[user.id];
username.style.color = online !== undefined ? online : "gray";
let profile = await client.profiles.getProfileId(user.id);
let online = profile.online;
if (online == undefined)
username.style.color = "gray";
if (online == true)
username.style.color = "green";
else
username.style.color = "red";
}
username.appendChild(document.createTextNode(user.username));
new_user.appendChild(username);