-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Skip the @
char when displaying a room Avatar based on its name
#312
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I'm not sure this change is correct. If a username has non-alphanumeric characters at the beginning, wouldn't this change skip over them? It seems like we would want to display the first character in the room name, so I'm surprised my original function is wrong.
What are the raw text names of these rooms? Perhaps we can determine a better conditional, since I don't think we should skip all non-alphanumeric chars.
Hi @kevinaboos This is an edge case, and the idea for this change comes from Element. When I create a room, invite two or more people, and don’t name the room or set an avatar, the room name will display all the members' names. For example, if I invite In Element, special characters are skipped to display the avatar properly. But in Robrix, it can’t render special characters, so it shows a |
Of course, there’s also the case where the user sets the room name to a special character, like |
Oh ok so we should just skip the leading Seems like you could just use the same function here: Lines 118 to 123 in da624f3
|
We cannot assume that, hence my suggestion above. |
Ok, I get it. Now it just skip |
@
char when displaying a room Avatar based on its name
The original algorithm only returned the first character, so if the first character of the room name was a special character, it wouldn't show up in the user avatar. I modified the code to return the first valid character, ensuring the avatar displays properly. In the image above, the first and third rooms show correctly. Without this fix, it would return a
"?"
.