mirror of
https://github.com/tulir/gomuks.git
synced 2025-04-19 18:13:41 -05:00
fixup! web/timeline: render MSC4144 per-message profiles
Signed-off-by: Sumner Evans <me@sumnerevans.com>
This commit is contained in:
parent
fa52b44781
commit
0af5b14c57
1 changed files with 5 additions and 4 deletions
|
@ -81,12 +81,13 @@ function getFallbackCharacter(from: unknown, idx: number): string {
|
||||||
export const getAvatarURL = (userID: UserID, content?: UserProfile | null): string | undefined => {
|
export const getAvatarURL = (userID: UserID, content?: UserProfile | null): string | undefined => {
|
||||||
const fallbackCharacter = getFallbackCharacter(content?.displayname, 0) || getFallbackCharacter(userID, 1)
|
const fallbackCharacter = getFallbackCharacter(content?.displayname, 0) || getFallbackCharacter(userID, 1)
|
||||||
const backgroundColor = getUserColor(userID)
|
const backgroundColor = getUserColor(userID)
|
||||||
|
let server: string | undefined
|
||||||
|
let mediaID: string | undefined
|
||||||
if (content?.avatar_file) {
|
if (content?.avatar_file) {
|
||||||
const [server, mediaID] = parseMXC(content.avatar_file.url)
|
[server, mediaID] = parseMXC(content.avatar_file.url)
|
||||||
const fallback = `${backgroundColor}:${fallbackCharacter}`
|
} else {
|
||||||
return `_gomuks/media/${server}/${mediaID}?encrypted=true&fallback=${encodeURIComponent(fallback)}`
|
[server, mediaID] = parseMXC(content?.avatar_url)
|
||||||
}
|
}
|
||||||
const [server, mediaID] = parseMXC(content?.avatar_url)
|
|
||||||
if (!mediaID) {
|
if (!mediaID) {
|
||||||
return makeFallbackAvatar(backgroundColor, fallbackCharacter)
|
return makeFallbackAvatar(backgroundColor, fallbackCharacter)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue