remove pfps/avatars and display names upon deactivation

Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
strawberry committed 2024-06-11 01:19:18 -04:00
1 parent 25d44cad31
commit ea03a50e21
3 files changed
+72 -23

No files matched your search

+11 -1
View File
@@ -15,7 +15,7 @@ use ruma::{
uiaa::{AuthFlow, AuthType, UiaaInfo},
},
events::{room::message::RoomMessageEventContent, GlobalAccountDataEventType},
push, UserId,
push, OwnedRoomId, UserId,
};
use tracing::{error, info, warn};
@@ -550,6 +550,16 @@ pub(crate) async fn deactivate_route(
// Remove devices and mark account as deactivated
services().users.deactivate_account(sender_user)?;
// Remove profile pictures and display name
let all_joined_rooms: Vec<OwnedRoomId> = services()
.rooms
.state_cache
.rooms_joined(sender_user)
.filter_map(Result::ok)
.collect();
super::update_displayname(sender_user.clone(), None, all_joined_rooms.clone()).await?;
super::update_avatar_url(sender_user.clone(), None, None, all_joined_rooms).await?;
// Make the user leave all rooms before deactivation
super::leave_all_rooms(sender_user).await;