refactor: rename is_recipient

This commit is contained in:
莘权 马 2023-11-08 13:42:08 +08:00
parent 93ebe8c103
commit af4c87e123
8 changed files with 19 additions and 19 deletions

View file

@ -65,8 +65,8 @@ class Routes(BaseModel):
self.routes.append({})
return self.routes[0]
def is_recipient(self, tags: Set) -> bool:
"""Check if it is the message recipient."""
def contain_any(self, tags: Set) -> bool:
"""Check if this object contains these tags."""
route = self._get_route()
to_tags = route.get(MESSAGE_ROUTE_TO)
if not to_tags:
@ -206,9 +206,9 @@ class Message(BaseModel):
"""Add a subscription label for the recipients."""
self.route.add_to(tag)
def is_recipient(self, tags: Set):
def contain_any(self, tags: Set):
"""Return true if any input label exists in the message's subscription labels."""
return self.route.is_recipient(tags)
return self.route.contain_any(tags)
def __str__(self):
# prefix = '-'.join([self.role, str(self.cause_by)])