Profile bios
This commit is contained in:
1 parent
e08d687d59
commit
58195e89d8
7 files changed
+343
-27
No files matched your search
+1
-1
@@ -12,7 +12,7 @@
|
||||
- Bug fix for images/links/anything that loads after room is opened, properly shifting the scroll to the bottom.
|
||||
- Client-side nicknames for other users. PR #3
|
||||
- Inline editor for editing messages.
|
||||
- Pronouns and timezones.
|
||||
- Pronouns, bios, and timezones.
|
||||
- Pressing send on mobile no longer closes keyboard.
|
||||
- Pressing enter on mobile will always provide a newline, ignores the setting for desktop.
|
||||
- More reactive UI (literally just buttons shifting up and shrinking on click)
|
||||
|
||||
@@ -73,6 +73,8 @@ type CustomEditorProps = {
|
||||
onKeyUp?: KeyboardEventHandler;
|
||||
onChange?: EditorChangeHandler;
|
||||
onPaste?: ClipboardEventHandler;
|
||||
className?: string;
|
||||
variant?: "Surface" | "SurfaceVariant" | "Background";
|
||||
};
|
||||
export const CustomEditor = forwardRef<HTMLDivElement, CustomEditorProps>(
|
||||
(
|
||||
@@ -89,6 +91,8 @@ export const CustomEditor = forwardRef<HTMLDivElement, CustomEditorProps>(
|
||||
onKeyUp,
|
||||
onChange,
|
||||
onPaste,
|
||||
className,
|
||||
variant = "SurfaceVariant",
|
||||
},
|
||||
ref
|
||||
) => {
|
||||
@@ -127,7 +131,7 @@ export const CustomEditor = forwardRef<HTMLDivElement, CustomEditorProps>(
|
||||
);
|
||||
|
||||
return (
|
||||
<div className={css.Editor} ref={ref}>
|
||||
<div className={`${css.Editor} ${className || ''}`} ref={ref}>
|
||||
<Slate editor={editor} initialValue={initialValue} onChange={onChange}>
|
||||
{top}
|
||||
<Box alignItems="Start">
|
||||
@@ -138,10 +142,10 @@ export const CustomEditor = forwardRef<HTMLDivElement, CustomEditorProps>(
|
||||
)}
|
||||
<Scroll
|
||||
className={css.EditorTextareaScroll}
|
||||
variant="SurfaceVariant"
|
||||
variant={variant}
|
||||
style={{ maxHeight }}
|
||||
size="300"
|
||||
visibility="Hover"
|
||||
visibility="Always"
|
||||
hideTrack
|
||||
>
|
||||
<Editable
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import { Box, Button, config, Icon, Icons, Text } from 'folds';
|
||||
import React, { useState } from 'react';
|
||||
import { Box, Button, config, Icon, Icons, Scroll, Text } from 'folds';
|
||||
import React, { useCallback, useMemo, useState } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { useAtomValue } from 'jotai';
|
||||
import { Opts as LinkifyOpts, Opts } from 'linkifyjs';
|
||||
import { HTMLReactParserOptions } from 'html-react-parser';
|
||||
import { UserHero, UserHeroName } from './UserHero';
|
||||
import { getMxIdServer, mxcUrlToHttp } from '../../utils/matrix';
|
||||
import { getMemberAvatarMxc, getMemberDisplayName } from '../../utils/room';
|
||||
@@ -25,9 +27,17 @@ import { getDirectCreatePath, withSearchParam } from '../../pages/pathUtils';
|
||||
import { DirectCreateSearchParams } from '../../pages/paths';
|
||||
import { nicknamesAtom } from '../../state/nicknames';
|
||||
import { UserProfile, useUserProfile } from '../../hooks/useUserProfile';
|
||||
import { RenderBody } from '../message';
|
||||
import { factoryRenderLinkifyWithMention, getReactCustomHtmlParser, LINKIFY_OPTS, makeMentionCustomProps, renderMatrixMention } from '../../plugins/react-custom-html-parser';
|
||||
import { useSpoilerClickHandler } from '../../hooks/useSpoilerClickHandler';
|
||||
|
||||
type UserExtendedSectionProps = {
|
||||
profile: UserProfile;
|
||||
htmlReactParserOptions: HTMLReactParserOptions;
|
||||
linkifyOpts: LinkifyOpts;
|
||||
};
|
||||
|
||||
function UserExtendedSection({ profile }: { profile: UserProfile }) {
|
||||
function UserExtendedSection({ profile, htmlReactParserOptions, linkifyOpts }: UserExtendedSectionProps) {
|
||||
const clamp = (str: string, len: number) => str.length > len ? `${str.slice(0, len)}...` : str;
|
||||
const [showMore, setShowMore] = useState(false);
|
||||
|
||||
@@ -39,13 +49,25 @@ function UserExtendedSection({ profile }: { profile: UserProfile }) {
|
||||
timeZone: timezone,
|
||||
}).format(new Date()) : null;
|
||||
|
||||
const bioContent = useMemo(() => {
|
||||
const rawBio = profile.extended?.["moe.sable.app.bio"] || profile.bio;
|
||||
if (!rawBio) return null;
|
||||
|
||||
const safetyTrim = rawBio.length > 2048 ? rawBio.slice(0, 2048) : rawBio;
|
||||
|
||||
const visibleText = safetyTrim.replace(/<[^>]*>?/gm, '');
|
||||
const VISIBLE_LIMIT = 512;
|
||||
|
||||
if (visibleText.length <= VISIBLE_LIMIT) return safetyTrim;
|
||||
|
||||
return safetyTrim;
|
||||
}, [profile]);
|
||||
|
||||
const unknownFields = Object.entries(profile.extended || {}).filter(([, value]) =>
|
||||
typeof value === 'string' || typeof value === 'number');
|
||||
|
||||
if (!pronouns && !localTime && unknownFields.length === 0) return null;
|
||||
|
||||
return (
|
||||
<Box direction="Column" gap="200" style={{ marginBottom: config.space.S100 }}>
|
||||
<Box direction="Column" gap="400" style={{ marginBottom: config.space.S100 }}>
|
||||
{pronouns && (
|
||||
<Box alignItems="Center" gap="200">
|
||||
<Icon size="100" src={Icons.User} style={{ opacity: 0.5 }} />
|
||||
@@ -63,8 +85,40 @@ function UserExtendedSection({ profile }: { profile: UserProfile }) {
|
||||
</Box>
|
||||
)}
|
||||
|
||||
{bioContent && (
|
||||
<Box direction="Column" gap="200">
|
||||
<Box alignItems="Center" gap="200">
|
||||
<Icon size="100" src={Icons.Pencil} style={{ opacity: 0.5 }} />
|
||||
<Text size="T200" priority="300">About me</Text>
|
||||
</Box>
|
||||
|
||||
<Scroll
|
||||
direction="Vertical"
|
||||
variant="SurfaceVariant"
|
||||
visibility="Always"
|
||||
size="300"
|
||||
style={{
|
||||
backgroundColor: 'var(--sable-bg-container)',
|
||||
borderRadius: config.radii.R500,
|
||||
maxHeight: '200px',
|
||||
}}
|
||||
>
|
||||
<Box style={{ padding: config.space.S300, wordBreak: 'break-word' }}>
|
||||
<Text size="T200" priority="400" as="div">
|
||||
<RenderBody
|
||||
body={bioContent}
|
||||
customBody={bioContent}
|
||||
htmlReactParserOptions={htmlReactParserOptions}
|
||||
linkifyOpts={linkifyOpts}
|
||||
/>
|
||||
</Text>
|
||||
</Box>
|
||||
</Scroll>
|
||||
</Box>
|
||||
)}
|
||||
|
||||
{unknownFields.length > 0 && (
|
||||
<Box direction="Column" gap="100" style={{ marginTop: config.space.S100 }}>
|
||||
<Box direction="Column" gap="200">
|
||||
<Button
|
||||
variant="Secondary"
|
||||
size="300"
|
||||
@@ -77,16 +131,9 @@ function UserExtendedSection({ profile }: { profile: UserProfile }) {
|
||||
</Button>
|
||||
|
||||
{showMore && (
|
||||
<Box
|
||||
direction="Column"
|
||||
style={{
|
||||
padding: config.space.S200,
|
||||
backgroundColor: 'var(--sable-surface-var-container)',
|
||||
borderRadius: config.radii.R400
|
||||
}}
|
||||
>
|
||||
<Box direction="Column" style={{ padding: config.space.S200, backgroundColor: 'var(--sable-surface-container)', borderRadius: config.radii.R400 }}>
|
||||
{unknownFields.map(([key, value]) => (
|
||||
<Box key={key} direction="Column">
|
||||
<Box key={key} direction="Column" style={{ marginBottom: config.space.S100 }}>
|
||||
<Text size="T200" priority="400" style={{ letterSpacing: '0.05em' }}>
|
||||
{clamp(key, 64).split('.').pop()?.replace(/_/g, ' ')}
|
||||
</Text>
|
||||
@@ -149,6 +196,33 @@ export function UserRoomProfile({ userId }: UserRoomProfileProps) {
|
||||
|
||||
const extendedProfile = useUserProfile(userId);
|
||||
|
||||
// Todo eventually maybe
|
||||
const mentionClickHandler = useCallback((e: React.SyntheticEvent<HTMLElement>) => {
|
||||
e.preventDefault();
|
||||
}, []);
|
||||
|
||||
const linkifyOpts = useMemo<Opts>(
|
||||
() => ({
|
||||
...LINKIFY_OPTS,
|
||||
render: factoryRenderLinkifyWithMention((href) =>
|
||||
renderMatrixMention(mx, room.roomId, href, makeMentionCustomProps(mentionClickHandler))
|
||||
),
|
||||
}),
|
||||
[mx, room, mentionClickHandler]
|
||||
);
|
||||
|
||||
const spoilerClickHandler = useSpoilerClickHandler();
|
||||
|
||||
const htmlReactParserOptions = useMemo<HTMLReactParserOptions>(
|
||||
() =>
|
||||
getReactCustomHtmlParser(mx, room.roomId, {
|
||||
linkifyOpts,
|
||||
useAuthentication,
|
||||
handleSpoilerClick: spoilerClickHandler,
|
||||
}),
|
||||
[mx, room, linkifyOpts, useAuthentication, spoilerClickHandler]
|
||||
);
|
||||
|
||||
return (
|
||||
<Box direction="Column">
|
||||
<UserHero
|
||||
@@ -175,7 +249,11 @@ export function UserRoomProfile({ userId }: UserRoomProfileProps) {
|
||||
</Box>
|
||||
)}
|
||||
</Box>
|
||||
<UserExtendedSection profile={extendedProfile} />
|
||||
<UserExtendedSection
|
||||
profile={extendedProfile}
|
||||
htmlReactParserOptions={htmlReactParserOptions}
|
||||
linkifyOpts={linkifyOpts}
|
||||
/>
|
||||
<Box alignItems="Center" gap="200" wrap="Wrap">
|
||||
{server && <ServerChip server={server} />}
|
||||
<ShareChip userId={userId} />
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
import { style, globalStyle } from '@vanilla-extract/css';
|
||||
|
||||
export const BioEditorContainer = style({
|
||||
backgroundColor: 'var(--sable-bg-container)',
|
||||
borderRadius: 'var(--radii-300)',
|
||||
});
|
||||
|
||||
globalStyle(`${BioEditorContainer} [class*="EditorTextarea"]`, {
|
||||
backgroundColor: 'var(--sable-bg-container) !important',
|
||||
});
|
||||
|
||||
globalStyle(`${BioEditorContainer} [class*="EditorTextareaScroll"]`, {
|
||||
backgroundColor: 'var(--sable-bg-container) !important',
|
||||
});
|
||||
|
||||
globalStyle(`${BioEditorContainer} [class*="Toolbar"]`, {
|
||||
backgroundColor: 'var(--sable-bg-container) !important',
|
||||
padding: 'var(--space-S100) !important',
|
||||
});
|
||||
|
||||
globalStyle(`${BioEditorContainer} [class*="Toolbar"] button`, {
|
||||
backgroundColor: 'var(--sable-bg-container) !important',
|
||||
});
|
||||
@@ -0,0 +1,200 @@
|
||||
import React, { KeyboardEventHandler, useCallback, useEffect, useState, useRef } from 'react';
|
||||
import { Box, Chip, Icon, IconButton, Icons, Line, PopOut, RectCords, Spinner, Text, config } from 'folds';
|
||||
import { Editor, Transforms } from 'slate';
|
||||
import { ReactEditor } from 'slate-react';
|
||||
import { isKeyHotkey } from 'is-hotkey';
|
||||
import {
|
||||
AUTOCOMPLETE_PREFIXES, AutocompletePrefix, AutocompleteQuery, CustomEditor,
|
||||
EmoticonAutocomplete, Toolbar, createEmoticonElement, getAutocompleteQuery,
|
||||
getPrevWorldRange, htmlToEditorInput, plainToEditorInput, moveCursor,
|
||||
toMatrixCustomHTML, toPlainText, trimCustomHtml, useEditor,
|
||||
} from '../../../components/editor';
|
||||
import { useSetting } from '../../../state/hooks/settings';
|
||||
import { settingsAtom } from '../../../state/settings';
|
||||
import { UseStateProvider } from '../../../components/UseStateProvider';
|
||||
import { EmojiBoard } from '../../../components/emoji-board';
|
||||
import { mobileOrTablet } from '../../../utils/user-agent';
|
||||
import { SettingTile } from '../../../components/setting-tile';
|
||||
import * as css from './BioEditor.css';
|
||||
|
||||
type BioEditorProps = {
|
||||
value?: string;
|
||||
isSaving?: boolean;
|
||||
imagePackRooms?: any[];
|
||||
onSave: (htmlContent: string) => void;
|
||||
};
|
||||
|
||||
const BIO_LIMIT = 512;
|
||||
|
||||
export function BioEditor({ value, isSaving, imagePackRooms, onSave }: BioEditorProps) {
|
||||
const editor = useEditor();
|
||||
const [enterForNewline] = useSetting(settingsAtom, 'enterForNewline');
|
||||
const [globalToolbar] = useSetting(settingsAtom, 'editorToolbar');
|
||||
const [isMarkdown] = useSetting(settingsAtom, 'isMarkdown');
|
||||
const [toolbar, setToolbar] = useState(globalToolbar);
|
||||
|
||||
const [autocompleteQuery, setAutocompleteQuery] = useState<AutocompleteQuery<AutocompletePrefix>>();
|
||||
const [hasChanged, setHasChanged] = useState(false);
|
||||
const [charCount, setCharCount] = useState(0);
|
||||
|
||||
const prevValue = useRef(value);
|
||||
const initialized = useRef(false);
|
||||
|
||||
const updateStats = useCallback(() => {
|
||||
const plainText = toPlainText(editor.children, isMarkdown).trim();
|
||||
setCharCount(plainText.length);
|
||||
}, [editor, isMarkdown]);
|
||||
|
||||
const handleSave = useCallback(() => {
|
||||
const plainText = toPlainText(editor.children, isMarkdown).trim();
|
||||
if (plainText.length > BIO_LIMIT) return;
|
||||
|
||||
const customHtml = trimCustomHtml(
|
||||
toMatrixCustomHTML(editor.children, {
|
||||
allowTextFormatting: true,
|
||||
allowBlockMarkdown: isMarkdown,
|
||||
allowInlineMarkdown: isMarkdown,
|
||||
})
|
||||
);
|
||||
|
||||
onSave(customHtml || plainText);
|
||||
setHasChanged(false);
|
||||
}, [editor, isMarkdown, onSave]);
|
||||
|
||||
useEffect(() => {
|
||||
const valueChanged = prevValue.current !== value;
|
||||
const isFirstValidLoad = !initialized.current && value !== undefined;
|
||||
|
||||
if (valueChanged || isFirstValidLoad) {
|
||||
prevValue.current = value;
|
||||
const incomingPlainText = value ? toPlainText(htmlToEditorInput(value, isMarkdown), isMarkdown).trim() : '';
|
||||
const currentPlainText = toPlainText(editor.children, isMarkdown).trim();
|
||||
|
||||
if (currentPlainText === incomingPlainText && initialized.current) return;
|
||||
|
||||
const isLikelyHtml = value?.includes('<') || value?.includes('>');
|
||||
const initialValue = isLikelyHtml
|
||||
? htmlToEditorInput(value!, isMarkdown)
|
||||
: plainToEditorInput(value ?? '', isMarkdown);
|
||||
|
||||
editor.children = initialValue;
|
||||
Editor.normalize(editor, { force: true });
|
||||
Transforms.select(editor, Editor.start(editor, []));
|
||||
|
||||
initialized.current = true;
|
||||
setHasChanged(false);
|
||||
updateStats();
|
||||
}
|
||||
}, [value, editor, isMarkdown, updateStats]);
|
||||
|
||||
const handleKeyDown: KeyboardEventHandler = useCallback((evt) => {
|
||||
if ((isKeyHotkey('mod+enter', evt) || (!enterForNewline && isKeyHotkey('enter', evt)))) {
|
||||
evt.preventDefault();
|
||||
handleSave();
|
||||
}
|
||||
}, [handleSave, enterForNewline]);
|
||||
|
||||
const handleKeyUp: KeyboardEventHandler = useCallback((evt) => {
|
||||
if (isKeyHotkey('escape', evt)) {
|
||||
evt.preventDefault();
|
||||
return;
|
||||
}
|
||||
const prevWordRange = getPrevWorldRange(editor);
|
||||
const query = prevWordRange
|
||||
? getAutocompleteQuery<AutocompletePrefix>(editor, prevWordRange, AUTOCOMPLETE_PREFIXES)
|
||||
: undefined;
|
||||
setAutocompleteQuery(query);
|
||||
}, [editor]);
|
||||
|
||||
const handleCloseAutocomplete = useCallback(() => {
|
||||
ReactEditor.focus(editor);
|
||||
setAutocompleteQuery(undefined);
|
||||
}, [editor]);
|
||||
|
||||
const handleEmoticonSelect = (key: string, shortcode: string) => {
|
||||
editor.insertNode(createEmoticonElement(key, shortcode));
|
||||
moveCursor(editor);
|
||||
setHasChanged(true);
|
||||
updateStats();
|
||||
};
|
||||
|
||||
const isOverLimit = charCount > BIO_LIMIT;
|
||||
|
||||
return (
|
||||
<Box direction="Column" gap="100">
|
||||
<SettingTile title="About You" description="Customize your bio." />
|
||||
<Box className={css.BioEditorContainer} direction="Column" style={{ position: 'relative' }}>
|
||||
{autocompleteQuery?.prefix === AutocompletePrefix.Emoticon && (
|
||||
<EmoticonAutocomplete imagePackRooms={imagePackRooms || []} editor={editor} query={autocompleteQuery} requestClose={handleCloseAutocomplete} />
|
||||
)}
|
||||
<CustomEditor
|
||||
editor={editor}
|
||||
placeholder="Write a bio..."
|
||||
onChange={() => { if (!hasChanged) setHasChanged(true); updateStats(); }}
|
||||
onKeyDown={handleKeyDown}
|
||||
onKeyUp={handleKeyUp}
|
||||
maxHeight="200px"
|
||||
variant="Background"
|
||||
bottom={
|
||||
<Box direction="Column" style={{ backgroundColor: 'var(--sable-bg-container)' }}>
|
||||
<Box style={{ padding: config.space.S200, paddingTop: 0 }} alignItems="End" justifyContent="SpaceBetween" gap="100">
|
||||
<Box gap="200" alignItems="Center">
|
||||
{hasChanged && (
|
||||
<Chip onClick={handleSave}
|
||||
variant={isOverLimit ? "Background" : "Primary"}
|
||||
radii="Pill"
|
||||
disabled={isSaving || isOverLimit}
|
||||
outlined
|
||||
before={isSaving ? <Spinner variant="Primary"
|
||||
fill="Soft"
|
||||
size="100" /> : undefined}>
|
||||
<Text size="B300">{isSaving ? 'Saving' : 'Save'}</Text>
|
||||
</Chip>
|
||||
)}
|
||||
<Text size="T200" priority={isOverLimit ? "500" : "300"} style={{ opacity: isOverLimit ? 1 : 0.6 }}>{charCount} / {BIO_LIMIT}</Text>
|
||||
</Box>
|
||||
<Box gap="Inherit">
|
||||
<IconButton variant="Background" size="300" radii="300" onClick={() => setToolbar(!toolbar)}>
|
||||
<Icon size="400" src={toolbar ? Icons.AlphabetUnderline : Icons.Alphabet} />
|
||||
</IconButton>
|
||||
<UseStateProvider initial={undefined}>
|
||||
{(anchor: RectCords | undefined, setAnchor) => (
|
||||
<PopOut anchor={anchor}
|
||||
alignOffset={-8}
|
||||
position="Top"
|
||||
align="End"
|
||||
content={<EmojiBoard
|
||||
imagePackRooms={imagePackRooms ?? []}
|
||||
returnFocusOnDeactivate={false}
|
||||
onEmojiSelect={handleEmoticonSelect}
|
||||
onCustomEmojiSelect={handleEmoticonSelect}
|
||||
requestClose={() => setAnchor((v) => {
|
||||
if (v) {
|
||||
if (!mobileOrTablet()) ReactEditor.focus(editor);
|
||||
return undefined;
|
||||
} return v;
|
||||
})
|
||||
}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<IconButton aria-pressed={anchor !== undefined}
|
||||
variant="Background"
|
||||
size="300"
|
||||
radii="300"
|
||||
onClick={(evt) => setAnchor(evt.currentTarget.getBoundingClientRect())}>
|
||||
<Icon size="400" src={Icons.Smile} filled={anchor !== undefined} />
|
||||
</IconButton>
|
||||
</PopOut>
|
||||
)}
|
||||
</UseStateProvider>
|
||||
</Box>
|
||||
</Box>
|
||||
{toolbar && (<Box direction="Column"><Line variant="Surface" size="300" /><Toolbar /></Box>)}
|
||||
</Box>
|
||||
}
|
||||
/>
|
||||
</Box>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
@@ -46,6 +46,7 @@ import { CompactUploadCardRenderer } from '../../../components/upload-card';
|
||||
import { useCapabilities } from '../../../hooks/useCapabilities';
|
||||
import { TimezoneEditor } from './TimezoneEditor';
|
||||
import { PronounEditor } from './PronounEditor';
|
||||
import { BioEditor } from './BioEditor';
|
||||
|
||||
type PronounSet = {
|
||||
summary: string;
|
||||
@@ -327,18 +328,25 @@ function ProfileExtended({ profile, userId }: ProfileProps) {
|
||||
return (
|
||||
<Box direction="Column" gap="100">
|
||||
<Text size="L400">Extended Profile</Text>
|
||||
<SequenceCard className={SequenceCardStyle} variant="SurfaceVariant" direction="Column" gap="400">
|
||||
<PronounEditor
|
||||
current={pronouns}
|
||||
onSave={(p) => handleSaveField("io.fsky.nyx.pronouns", p)}
|
||||
/>
|
||||
</SequenceCard>
|
||||
<SequenceCard className={SequenceCardStyle} variant="SurfaceVariant" direction="Column" gap="400">
|
||||
<TimezoneEditor
|
||||
current={profile.timezone}
|
||||
onSave={(tz) => {
|
||||
handleSaveField("us.cloke.msc4175.tz", tz);
|
||||
handleSaveField("m.tz", tz);
|
||||
}}
|
||||
/>
|
||||
</SequenceCard>
|
||||
<SequenceCard className={SequenceCardStyle} variant="SurfaceVariant" direction="Column" gap="400">
|
||||
<PronounEditor
|
||||
current={pronouns}
|
||||
onSave={(p) => handleSaveField("io.fsky.nyx.pronouns", p)}
|
||||
<BioEditor
|
||||
value={profile.extended?.["moe.sable.app.bio"] || profile.bio}
|
||||
onSave={(htmlBio) => handleSaveField("moe.sable.app.bio", htmlBio)}
|
||||
/>
|
||||
</SequenceCard>
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ export type UserProfile = {
|
||||
|
||||
pronouns?: any[]; // io.fsky.nyx.pronouns
|
||||
timezone?: string; // us.cloke.msc4175.tz
|
||||
bio?: string; // moe.sable.app.bio
|
||||
extended?: Record<string, any>; // any other fields
|
||||
};
|
||||
|
||||
@@ -42,7 +43,8 @@ export const useUserProfile = (userId: string): UserProfile => {
|
||||
avatarUrl: info.avatar_url,
|
||||
displayName: info.displayname,
|
||||
pronouns: info['io.fsky.nyx.pronouns'],
|
||||
timezone: info['us.cloke.msc4175.tz'],
|
||||
timezone: info['us.cloke.msc4175.tz'] || info['m.tz'],
|
||||
bio: info['moe.sable.app.bio'],
|
||||
extended: {},
|
||||
};
|
||||
|
||||
@@ -51,10 +53,11 @@ export const useUserProfile = (userId: string): UserProfile => {
|
||||
'displayname',
|
||||
'io.fsky.nyx.pronouns',
|
||||
'us.cloke.msc4175.tz',
|
||||
'm.tz'
|
||||
'm.tz',
|
||||
'moe.sable.app.bio'
|
||||
];
|
||||
Object.keys(info).forEach((key) => {
|
||||
if (!knownKeys.includes(key) && !key.startsWith('m.')) {
|
||||
if (!knownKeys.includes(key)) {
|
||||
normalized.extended![key] = info[key];
|
||||
}
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user