You've already forked matrix-react-sdk
							
							
				mirror of
				https://github.com/matrix-org/matrix-react-sdk.git
				synced 2025-11-04 11:51:45 +03:00 
			
		
		
		
	Run all room leaving behaviour through a single function
Fixes https://github.com/vector-im/element-web/issues/14999 Fixes https://github.com/vector-im/element-web/issues/10380 We were failing to handle errors when `/part`ing a room, though the leave room button was fine. This runs both the button and command through the same function for handling, including the 'view next room' behaviour.
This commit is contained in:
		@@ -43,7 +43,7 @@ import SdkConfig from "./SdkConfig";
 | 
			
		||||
import { ensureDMExists } from "./createRoom";
 | 
			
		||||
import { ViewUserPayload } from "./dispatcher/payloads/ViewUserPayload";
 | 
			
		||||
import { Action } from "./dispatcher/actions";
 | 
			
		||||
import { EffectiveMembership, getEffectiveMembership } from "./utils/membership";
 | 
			
		||||
import { EffectiveMembership, getEffectiveMembership, leaveRoomBehaviour } from "./utils/membership";
 | 
			
		||||
 | 
			
		||||
// XXX: workaround for https://github.com/microsoft/TypeScript/issues/31816
 | 
			
		||||
interface HTMLInputEvent extends Event {
 | 
			
		||||
@@ -601,11 +601,7 @@ export const Commands = [
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (!targetRoomId) targetRoomId = roomId;
 | 
			
		||||
            return success(
 | 
			
		||||
                cli.leaveRoomChain(targetRoomId).then(function() {
 | 
			
		||||
                    dis.dispatch({action: 'view_next_room'});
 | 
			
		||||
                }),
 | 
			
		||||
            );
 | 
			
		||||
            return success(leaveRoomBehaviour(targetRoomId));
 | 
			
		||||
        },
 | 
			
		||||
        category: CommandCategories.actions,
 | 
			
		||||
    }),
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user