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 
			
		
		
		
	Clean up asserted identity code (#7934)
* Clean up asserted identity code Add logging when we received asserted identity events but ignore them, and just disable the whole code path if it's not enabled in the config. * Actually, put the check back - better to check anyway * Update to ? syntax Co-authored-by: Michael Telatynski <7t3chguy@gmail.com> * Put back lost return Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
		@@ -152,9 +152,9 @@ export default class CallHandler extends EventEmitter {
 | 
			
		||||
    public roomIdForCall(call: MatrixCall): string {
 | 
			
		||||
        if (!call) return null;
 | 
			
		||||
 | 
			
		||||
        const voipConfig = SdkConfig.get()['voip'];
 | 
			
		||||
 | 
			
		||||
        if (voipConfig && voipConfig.obeyAssertedIdentity) {
 | 
			
		||||
        // check asserted identity: if we're not obeying asserted identity,
 | 
			
		||||
        // this map will never be populated, but we check anyway for sanity
 | 
			
		||||
        if (this.shouldObeyAssertedfIdentity()) {
 | 
			
		||||
            const nativeUser = this.assertedIdentityNativeUsers[call.callId];
 | 
			
		||||
            if (nativeUser) {
 | 
			
		||||
                const room = findDMForUser(MatrixClientPeg.get(), nativeUser);
 | 
			
		||||
@@ -262,6 +262,10 @@ export default class CallHandler extends EventEmitter {
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private shouldObeyAssertedfIdentity(): boolean {
 | 
			
		||||
        return SdkConfig.get()['voip']?.obeyAssertedIdentity;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public getSupportsPstnProtocol(): boolean {
 | 
			
		||||
        return this.supportsPstnProtocol;
 | 
			
		||||
    }
 | 
			
		||||
@@ -489,6 +493,11 @@ export default class CallHandler extends EventEmitter {
 | 
			
		||||
 | 
			
		||||
            logger.log(`Call ID ${call.callId} got new asserted identity:`, call.getRemoteAssertedIdentity());
 | 
			
		||||
 | 
			
		||||
            if (!this.shouldObeyAssertedfIdentity()) {
 | 
			
		||||
                logger.log("asserted identity not enabled in config: ignoring");
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            const newAssertedIdentity = call.getRemoteAssertedIdentity().id;
 | 
			
		||||
            let newNativeAssertedIdentity = newAssertedIdentity;
 | 
			
		||||
            if (newAssertedIdentity) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user