fix(Per-Message-Profiles): whitespace only names will now disable the addition of fallback text
This commit is contained in:
3 files changed
+8
-3
No files matched your search
@@ -0,0 +1,5 @@
|
||||
---
|
||||
default: patch
|
||||
---
|
||||
|
||||
fix the issue of empty displaynames of a persona, causing an empty fallback message, it will now ommit the fallback, if the name is empty or only consists of whitespace
|
||||
@@ -770,10 +770,10 @@ export const RoomInput = forwardRef<HTMLDivElement, RoomInputProps>(
|
||||
if (perMessageProfile) {
|
||||
content['com.beeper.per_message_profile'] = convertPerMessageProfileToBeeperFormat(
|
||||
perMessageProfile,
|
||||
perMessageProfile.name !== ''
|
||||
perMessageProfile.name.trim() !== ''
|
||||
);
|
||||
|
||||
if (perMessageProfile.name !== '') {
|
||||
if (perMessageProfile.name.trim() !== '') {
|
||||
// if a per-message profile is used, it must per spec include a fallback
|
||||
const prefix = `${perMessageProfile.name}: `;
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ export function convertPerMessageProfileToBeeperFormat(
|
||||
};
|
||||
// delete empty fields
|
||||
// to-do maybe find a better way of doing it
|
||||
if (!profile.name) delete beeperPMP.displayname;
|
||||
if (!profile.name || profile?.name.trim().length === 0) delete beeperPMP.displayname;
|
||||
if (!profile.avatarUrl) delete beeperPMP.avatar_url;
|
||||
if (!profile.pronouns || profile.pronouns?.length === 0) delete beeperPMP['io.fsky.nyx.pronouns'];
|
||||
if (!has_fallback) delete beeperPMP.has_fallback;
|
||||
|
||||
Reference in new issue
Block a user