Support Commet bios, incrase bio limit
This commit is contained in:
1 parent
34f61a120e
commit
07fce26551
6 files changed
+18
-8
No files matched your search
@@ -3,6 +3,8 @@
|
||||
## Version 1.0.1
|
||||
|
||||
- (potentially) fixed rare crash when changing rooms
|
||||
- Support Commet bios.
|
||||
- Raise bio limit to 1024 characters.
|
||||
|
||||
## Version 1.0.0
|
||||
|
||||
|
||||
@@ -51,13 +51,13 @@ function UserExtendedSection({ profile, htmlReactParserOptions, linkifyOpts }: U
|
||||
}).format(new Date()) : null;
|
||||
|
||||
const bioContent = useMemo(() => {
|
||||
const rawBio = profile.extended?.["moe.sable.app.bio"] || profile.bio;
|
||||
const rawBio = profile.extended?.["moe.sable.app.bio"] || profile.extended?.["chat.commet.profile_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;
|
||||
const VISIBLE_LIMIT = 1024;
|
||||
|
||||
if (visibleText.length <= VISIBLE_LIMIT) return safetyTrim;
|
||||
|
||||
|
||||
@@ -950,7 +950,7 @@ export function RoomTimeline({ room, eventId, roomInputRef, editor }: RoomTimeli
|
||||
displayName: info.displayname,
|
||||
pronouns: (info as any)['io.fsky.nyx.pronouns'],
|
||||
timezone: (info as any)['us.cloke.msc4175.tz'] || (info as any)['m.tz'],
|
||||
bio: (info as any)['moe.sable.app.bio'],
|
||||
bio: (info as any)['moe.sable.app.bio'] || (info as any)['chat.commet.profile_bio'],
|
||||
extended: info,
|
||||
};
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ type BioEditorProps = {
|
||||
onSave: (htmlContent: string) => void;
|
||||
};
|
||||
|
||||
const BIO_LIMIT = 512;
|
||||
const BIO_LIMIT = 1024;
|
||||
|
||||
export function BioEditor({ value, isSaving, imagePackRooms, onSave }: BioEditorProps) {
|
||||
const editor = useEditor();
|
||||
|
||||
@@ -345,8 +345,16 @@ function ProfileExtended({ profile, userId }: ProfileProps) {
|
||||
</SequenceCard>
|
||||
<SequenceCard className={SequenceCardStyle} variant="SurfaceVariant" direction="Column" gap="400">
|
||||
<BioEditor
|
||||
value={profile.extended?.["moe.sable.app.bio"] || profile.bio}
|
||||
onSave={(htmlBio) => handleSaveField("moe.sable.app.bio", htmlBio)}
|
||||
value={profile.extended?.["moe.sable.app.bio"] || profile.extended?.['chat.commet.profile_bio'] || profile.bio}
|
||||
onSave={(htmlBio) => {
|
||||
handleSaveField("moe.sable.app.bio", htmlBio)
|
||||
|
||||
const cleanedHtml = htmlBio.replace(/<br\/><\/blockquote>/g, "</blockquote>");
|
||||
handleSaveField("chat.commet.profile_bio", {
|
||||
"format": "org.matrix.custom.html",
|
||||
"formatted_body": cleanedHtml
|
||||
});
|
||||
}}
|
||||
/>
|
||||
</SequenceCard>
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ export const useUserProfile = (userId: string, initialProfile?: Partial<UserProf
|
||||
displayName: info.displayname,
|
||||
pronouns: info['io.fsky.nyx.pronouns'],
|
||||
timezone: info['us.cloke.msc4175.tz'] || info['m.tz'],
|
||||
bio: info['moe.sable.app.bio'],
|
||||
bio: info['moe.sable.app.bio'] || info['chat.commet.profile_bio'],
|
||||
extended: {},
|
||||
};
|
||||
|
||||
@@ -32,7 +32,7 @@ export const useUserProfile = (userId: string, initialProfile?: Partial<UserProf
|
||||
'displayname',
|
||||
'io.fsky.nyx.pronouns',
|
||||
'us.cloke.msc4175.tz', 'm.tz',
|
||||
'moe.sable.app.bio'
|
||||
'moe.sable.app.bio', 'chat.commet.profile_bio'
|
||||
];
|
||||
|
||||
Object.keys(info).forEach((key) => {
|
||||
|
||||
Reference in new issue
Block a user