diff options
author | Andrew Morgan <1342360+anoadragon453@users.noreply.github.com> | 2022-02-07 18:26:42 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-07 18:26:42 +0000 |
commit | cf06783d54b2b9090aef595a9094ddd857c1155b (patch) | |
tree | 697c9646d0ae19c01ebd02216a517bfd11661569 /synapse/appservice/__init__.py | |
parent | Pass the proper type when uploading files. (#11927) (diff) | |
download | synapse-cf06783d54b2b9090aef595a9094ddd857c1155b.tar.xz |
Remove optional state of `ApplicationService.is_interested`'s `store` parameter (#11911)
Diffstat (limited to 'synapse/appservice/__init__.py')
-rw-r--r-- | synapse/appservice/__init__.py | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/synapse/appservice/__init__.py b/synapse/appservice/__init__.py index 7dbebd97b5..a340a8c9c7 100644 --- a/synapse/appservice/__init__.py +++ b/synapse/appservice/__init__.py @@ -165,23 +165,16 @@ class ApplicationService: return namespace.exclusive return False - async def _matches_user( - self, event: Optional[EventBase], store: Optional["DataStore"] = None - ) -> bool: - if not event: - return False - + async def _matches_user(self, event: EventBase, store: "DataStore") -> bool: if self.is_interested_in_user(event.sender): return True + # also check m.room.member state key if event.type == EventTypes.Member and self.is_interested_in_user( event.state_key ): return True - if not store: - return False - does_match = await self.matches_user_in_member_list(event.room_id, store) return does_match @@ -216,21 +209,15 @@ class ApplicationService: return self.is_interested_in_room(event.room_id) return False - async def _matches_aliases( - self, event: EventBase, store: Optional["DataStore"] = None - ) -> bool: - if not store or not event: - return False - + async def _matches_aliases(self, event: EventBase, store: "DataStore") -> bool: alias_list = await store.get_aliases_for_room(event.room_id) for alias in alias_list: if self.is_interested_in_alias(alias): return True + return False - async def is_interested( - self, event: EventBase, store: Optional["DataStore"] = None - ) -> bool: + async def is_interested(self, event: EventBase, store: "DataStore") -> bool: """Check if this service is interested in this event. Args: |