Don't show discriminator
This commit is contained in:
parent
44dd71a1d1
commit
8c6222f4d4
@ -27,8 +27,8 @@
|
|||||||
<div class="author">
|
<div class="author">
|
||||||
<a href="https://discord.com/users/{author.id}" class="link" style="gap: 4px">
|
<a href="https://discord.com/users/{author.id}" class="link" style="gap: 4px">
|
||||||
<img src="https://cdn.discordapp.com/avatars/{author.id}/{author.avatar}.webp" class="author-avatar"
|
<img src="https://cdn.discordapp.com/avatars/{author.id}/{author.avatar}.webp" class="author-avatar"
|
||||||
alt="Author avatar" on:error={(e) => handleAvatarError(e, author.discriminator)}/>
|
alt="Author avatar" on:error={(e) => handleAvatarError(e, author.id)}/>
|
||||||
<b>{author.username}#{author.discriminator}</b>
|
<b>{author.global_name || author.username}</b>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
{:else if showAuthor}
|
{:else if showAuthor}
|
||||||
@ -73,6 +73,7 @@
|
|||||||
import Badge from "../Badge.svelte";
|
import Badge from "../Badge.svelte";
|
||||||
import {Navigate} from "svelte-router-spa";
|
import {Navigate} from "svelte-router-spa";
|
||||||
import {createEventDispatcher} from "svelte";
|
import {createEventDispatcher} from "svelte";
|
||||||
|
import {getIconUrl} from "../../js/icons";
|
||||||
|
|
||||||
const dispatch = createEventDispatcher();
|
const dispatch = createEventDispatcher();
|
||||||
|
|
||||||
@ -98,8 +99,8 @@
|
|||||||
logo.src = "/assets/img/grey.png";
|
logo.src = "/assets/img/grey.png";
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleAvatarError(ev, discriminator) {
|
function handleAvatarError(ev, id) {
|
||||||
const src = `https://cdn.discordapp.com/embed/avatars/${(discriminator || 0) % 5}.png`;
|
const src = getIconUrl(id, "");
|
||||||
if (ev.target.src === src) { // Setting onerror to null does not work with svelte
|
if (ev.target.src === src) { // Setting onerror to null does not work with svelte
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user