no pings in hidden channels

This commit is contained in:
MathMan05
2026-03-02 11:26:20 -06:00
parent 50fbe6b5ba
commit 4a8bc7b640
3 changed files with 27 additions and 4 deletions

View File

@@ -1659,7 +1659,7 @@ class Guild extends SnowFlake {
get mentions() {
let mentions = 0;
for (const thing of this.channels) {
mentions += thing.mentions;
if (thing.visible) mentions += thing.mentions;
}
return mentions;
}

View File

@@ -425,8 +425,6 @@ class Localuser {
}
this.pingEndpoint();
this.generateFavicon();
}
inrelation = new Set<User>();
outoffocus(): void {
@@ -537,7 +535,11 @@ class Localuser {
console.log("in here?");
returny();
}
} catch {}
} catch (e) {
if (!(e instanceof SyntaxError)) {
console.error(e);
}
}
}
})();
}
@@ -1557,6 +1559,7 @@ class Localuser {
async init() {
const location = window.location.href.split("/");
this.buildservers();
this.generateFavicon();
if (location[3] === "channels") {
const guild = this.loadGuild(location[4]);
if (!guild) {

View File

@@ -932,6 +932,26 @@ class User extends SnowFlake {
}
static async resolve(id: string, localuser: Localuser): Promise<User> {
const time = SnowFlake.stringToUnixTime(id);
if (time < 1420070400000 + 100)
return new User(
{
id: "0",
public_flags: 0,
username: I18n.friends.notfound(),
avatar: null,
discriminator: "0000",
bio: "",
bot: false,
premium_type: 0,
premium_since: "",
accent_color: 0,
theme_colors: null,
badge_ids: [],
},
localuser,
);
let user: User | undefined;
if ((user = localuser.userMap.get(id))) return user;
const json = await fetch(localuser.info.api.toString() + "/users/" + id + "/profile", {