@@ -7,10 +7,15 @@ import colorMXID from '$utils/colorMXID';
77import { profilesCacheAtom } from '$state/userRoomProfile' ;
88import { useSetting } from '$state/hooks/settings' ;
99import { settingsAtom } from '$state/settings' ;
10+ import { MSC1767Text } from '$types/matrix/common' ;
1011import { useMatrixClient } from './useMatrixClient' ;
1112
1213const inFlightProfiles = new Map < string , Promise < any > > ( ) ;
1314
15+ export type MSC4440Bio = {
16+ 'm.text' : Array < MSC1767Text > ;
17+ } ;
18+
1419export type UserProfile = {
1520 avatarUrl ?: string ;
1621 displayName ?: string ;
@@ -27,6 +32,7 @@ export type UserProfile = {
2732} ;
2833
2934const normalizeInfo = ( info : any ) : UserProfile => {
35+ const msc4440Bio = info [ 'gay.fomx.biography' ] as MSC4440Bio | undefined ;
3036 const knownKeys = new Set ( [
3137 'avatar_url' ,
3238 'displayname' ,
@@ -35,6 +41,7 @@ const normalizeInfo = (info: any): UserProfile => {
3541 'm.tz' ,
3642 'moe.sable.app.bio' ,
3743 'chat.commet.profile_bio' ,
44+ 'gay.fomx.biography' ,
3845 'chat.commet.profile_banner' ,
3946 'chat.commet.profile_status' ,
4047 'moe.sable.app.name_color' ,
@@ -54,7 +61,7 @@ const normalizeInfo = (info: any): UserProfile => {
5461 displayName : info . displayname ,
5562 pronouns : info [ 'io.fsky.nyx.pronouns' ] ,
5663 timezone : info [ 'us.cloke.msc4175.tz' ] || info [ 'm.tz' ] ,
57- bio : info [ 'moe.sable.app.bio' ] || info [ 'chat.commet.profile_bio' ] ,
64+ bio : msc4440Bio ?. [ 'm.text' ] ?. [ 0 ] ?. body || info [ 'moe.sable.app.bio' ] || info [ 'chat.commet.profile_bio' ] ,
5865 status : info [ 'chat.commet.profile_status' ] ,
5966 bannerUrl : info [ 'chat.commet.profile_banner' ] ,
6067 nameColor : info [ 'moe.sable.app.name_color' ] ,
@@ -94,7 +101,11 @@ export const useUserProfile = (
94101 const cached = useAtomValue ( userSelector ) ;
95102 const setGlobalProfiles = useSetAtom ( profilesCacheAtom ) ;
96103
97- const needsFetch = ! ! userId && userId !== 'undefined' && ! cached ?. _fetched ;
104+ const hasOnlyFetchedMarker =
105+ cached ?. _fetched === true && Object . keys ( cached ) . every ( ( key ) => key === '_fetched' ) ;
106+
107+ const needsFetch =
108+ ! ! userId && userId !== 'undefined' && ( ! cached ?. _fetched || hasOnlyFetchedMarker ) ;
98109
99110 useEffect ( ( ) => {
100111 if ( ! needsFetch ) return undefined ;
0 commit comments