Fix missing room display name when a room has no specified name#3822
Fix missing room display name when a room has no specified name#3822yureitzk wants to merge 1 commit intoconversejs:masterfrom
Conversation
| this.save({ name: identity.get('name') }); | ||
| } else { | ||
| log.error(`No identity or name found for ${this.get('jid')}`); | ||
| this.save({ name: this.get('jid') }); |
There was a problem hiding this comment.
Thanks for the pull request @yureitzk
In the past we used to store the JID as a fallback value for name for different entities, but stopped doing so because strictly speaking the JID is not the name and it's better to have an undefined name to make it clear that there is no known name value.
Instead, we have the getDisplayName method (which you mentioned in your PR description) that gets called to get the correct name to display for a entity (e.g. a MUC, occupant, roster contact or 1:1 chat).
So I think the fix needs to go into getDisplayName or code related to it.
There was a problem hiding this comment.
I was thinking about this as well, but getDisplayName will not fallback to JID, since if name attribute is missing, get will return Symbol(lit-nothing) string. But the main issue was that the bookmark's name is also Symbol(lit-nothing) . You'll see this upon the next login, when converse will fetch the bookmarks from the server.
Also, when you click on this empty bookmark, the room's name in main UI will be set to the same empty string.
This problem will go away if the chat will get a proper name aka title.
There was a problem hiding this comment.
I was thinking about this as well, but getDisplayName will not fallback to JID, since if name attribute is missing, get will return Symbol(lit-nothing) string
Yes, so a better fix (more like a workaround until #3815 is fixed) is to check whether a Symbol(lit-nothing) string is returned and in that case fall back to the JID.
It's ugly, but it prevents us from having to set the name to the JID, which I'd like to avoid.
|
@yureitzk: Have you progressed on it? |
This pull request addresses a bug that occurs when a room initially lacks a name. After logging out and logging back, the room's name displayed in bookmarks will show as
nothingdue to how the bookmark data was uploaded to the server.The
getDisplayNamefunction doesn't check if the room’s name is still missing when a bookmark is created. Theget()method always returns a string, so there's no automatic fallback to JID.I don't think it's the only way to solve this issue, but look like the easiest one.
Before submitting your request, please make sure the following conditions are met:
CHANGES.mddocument it in
docs/source/configuration.rstwith
make checkor you can run them in the browser by runningmake serveand then opening
http://localhost:8000/tests.html.