dont send avatar url or display name for ban membership events

the display name or avatar may be offensive

Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
strawberry 2024-05-09 11:26:55 -04:00 committed by June
parent d15e461303
commit 328502c1cd

View file

@ -400,11 +400,11 @@ pub(crate) async fn ban_user_route(body: Ruma<ban_user::v3::Request>) -> Result<
.map_or( .map_or(
Ok(RoomMemberEventContent { Ok(RoomMemberEventContent {
membership: MembershipState::Ban, membership: MembershipState::Ban,
displayname: services().users.displayname(&body.user_id)?, displayname: None,
avatar_url: services().users.avatar_url(&body.user_id)?, avatar_url: None,
is_direct: None, is_direct: None,
third_party_invite: None, third_party_invite: None,
blurhash: services().users.blurhash(&body.user_id)?, blurhash: services().users.blurhash(&body.user_id).unwrap_or_default(),
reason: body.reason.clone(), reason: body.reason.clone(),
join_authorized_via_users_server: None, join_authorized_via_users_server: None,
}), }),
@ -412,14 +412,8 @@ pub(crate) async fn ban_user_route(body: Ruma<ban_user::v3::Request>) -> Result<
serde_json::from_str(event.content.get()) serde_json::from_str(event.content.get())
.map(|event: RoomMemberEventContent| RoomMemberEventContent { .map(|event: RoomMemberEventContent| RoomMemberEventContent {
membership: MembershipState::Ban, membership: MembershipState::Ban,
displayname: services() displayname: None,
.users avatar_url: None,
.displayname(&body.user_id)
.unwrap_or_default(),
avatar_url: services()
.users
.avatar_url(&body.user_id)
.unwrap_or_default(),
blurhash: services().users.blurhash(&body.user_id).unwrap_or_default(), blurhash: services().users.blurhash(&body.user_id).unwrap_or_default(),
reason: body.reason.clone(), reason: body.reason.clone(),
join_authorized_via_users_server: None, join_authorized_via_users_server: None,