fix(membership): check if server is in room to decide whether to do remote leaves
Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
parent
6078b5ee9d
commit
3b5794b5bd
1 changed files with 5 additions and 1 deletions
|
@ -1476,7 +1476,11 @@ pub async fn leave_all_rooms(user_id: &UserId) -> Result<()> {
|
||||||
|
|
||||||
pub async fn leave_room(user_id: &UserId, room_id: &RoomId, reason: Option<String>) -> Result<()> {
|
pub async fn leave_room(user_id: &UserId, room_id: &RoomId, reason: Option<String>) -> Result<()> {
|
||||||
// Ask a remote server if we don't have this room
|
// Ask a remote server if we don't have this room
|
||||||
if !services().rooms.metadata.exists(room_id)? && room_id.server_name() != Some(services().globals.server_name()) {
|
if !services()
|
||||||
|
.rooms
|
||||||
|
.state_cache
|
||||||
|
.server_in_room(services().globals.server_name(), room_id)?
|
||||||
|
{
|
||||||
if let Err(e) = remote_leave_room(user_id, room_id).await {
|
if let Err(e) = remote_leave_room(user_id, room_id).await {
|
||||||
warn!("Failed to leave room {} remotely: {}", user_id, e);
|
warn!("Failed to leave room {} remotely: {}", user_id, e);
|
||||||
// Don't tell the client about this error
|
// Don't tell the client about this error
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue