Add Message.has_recipient()
method.
This commit is contained in:
parent
30a84767c9
commit
000b795fb0
|
@ -74,6 +74,16 @@ class Message(Base):
|
|||
kwargs['recipient'] = user
|
||||
self.recipients.append(MessageRecipient(**kwargs))
|
||||
|
||||
def has_recipient(self, user):
|
||||
"""
|
||||
Returns boolean indicating whether the given user is listed among the
|
||||
message's recipients.
|
||||
"""
|
||||
for recipient in self.recipients:
|
||||
if recipient.recipient is user:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
class MessageRecipient(Base):
|
||||
"""
|
||||
|
|
Loading…
Reference in a new issue