-
-
Notifications
You must be signed in to change notification settings - Fork 640
Stop re-adding displayname
/avatar
fields to leave/ban state events
#5011
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
base: develop
Are you sure you want to change the base?
Stop re-adding displayname
/avatar
fields to leave/ban state events
#5011
Conversation
…e and ban state events Signed-off-by: Ginger <ginger@gingershaped.computer>
The comment fairly strongly suggests that it does it for a reason though… will this cause, eg. all messages from people who've left to appear with no display name / avatar? Or is this fine because that's kept in the sentinel events? Do all clients actually use them reliably? Also, I know you've not written any new code here but some tests could go a long way to help set out what we think should happen, eg: "member event for left user should not contain display name", "member event on historical message for left user should contain display name" etc. |
I suspect that this code was originally added for the convenience of client developers, so they wouldn't have to add extra logic when looking up the display names and avatars of users which are no longer in the room. However, it also removed the client's ability to choose if those users should have their display names and avatars visible. I believe that deciding if and when to show that data should be the responsibility of the client, not the SDK, because having the SDK silently add the fields back in can cause surprising behavior. In fact, I opened this PR after discovering that Cinny showed the abusive avatar of a banned troll even though the troll's join event was redacted. |
To be more specific, here's the scenario I observed:
It might be desirable in the future for |
The js-sdk's current behaviour does seem a bit dumb here. While returning no avatar / display name for left users might be argued to be technically correct, if it's going to cause clients to suddenly start displaying left users with no display name or avatar, I don't think this is a thing we can just hit merge on. It would at least be a breaking change. If possible, fixing |
As written this is currently a breaking change, yeah. I'll investigate fixing |
This PR removes a snippet of code that quietly re-added
displayname
andavatar_url
fields to the cached version ofleave
andban
m.room.member
state events stored inRoomMember
objects. This code caused the cached member event to be inconsistent with the actual member event returned by other functions, and also caused the (potentially abusive) avatars and displaynames of banned users to appear in clients which call functions that access the cached data.Checklist
public
/exported
symbols have accurate TSDoc documentation.