Pārlūkot izejas kodu

style updates from code review

Co-Authored-By: Tulir Asokan <tulir@maunium.net>
Sumner Evans 3 gadi atpakaļ
vecāks
revīzija
ffe8df539a
2 mainītis faili ar 4 papildinājumiem un 11 dzēšanām
  1. 1 4
      mausignald/signald.py
  2. 3 7
      mautrix_signal/portal.py

+ 1 - 4
mausignald/signald.py

@@ -68,10 +68,7 @@ class SignaldClient(SignaldRPCClient):
         self.log.info(f"Connected to {name} v{version}")
 
     async def _websocket_connection_state_change(self, change_event: Dict[str, Any]) -> None:
-        evt = WebsocketConnectionStateChangeEvent(
-            state=WebsocketConnectionState.deserialize(change_event["data"]["state"]),
-            account=change_event["data"]["account"],
-        )
+        evt = WebsocketConnectionStateChangeEvent.deserialize(change_event["data"])
         await self._run_event_handler(evt)
 
     async def subscribe(self, username: str) -> bool:

+ 3 - 7
mautrix_signal/portal.py

@@ -292,15 +292,11 @@ class Portal(DBPortal, BasePortal):
                                    mentions=mentions, quote=quote, attachments=attachments,
                                    timestamp=request_id)
         except Exception as e:
-            authroization_failed_exception = (
+            auth_failed = (
                 "org.whispersystems.signalservice.api.push.exceptions.AuthorizationFailedException"
             )
-            if isinstance(e, ResponseError):
-                if authroization_failed_exception in e.data.get("exceptions"):
-                    await sender.push_bridge_state(
-                        BridgeStateEvent.BAD_CREDENTIALS,
-                        error=str(e),
-                    )
+            if isinstance(e, ResponseError) and auth_failed in e.data.get("exceptions"):
+                await sender.push_bridge_state(BridgeStateEvent.BAD_CREDENTIALS, error=str(e))
             await self._send_message(
                 self.main_intent,
                 TextMessageEventContent(