1
0
Fork 0

refactor: eagerly use a set in recipients, get_recipients

This commit is contained in:
Adeodato Simó 2024-01-26 06:29:59 -03:00
parent 31babdfa51
commit 8ac873419f
No known key found for this signature in database
GPG key ID: CDF447845F1A986F
2 changed files with 16 additions and 15 deletions

View file

@ -107,14 +107,14 @@ class Status(OrderedCollectionPageMixin, BookWyrmModel):
@property
def recipients(self):
"""tagged users who definitely need to get this status in broadcast"""
mentions = [u for u in self.mention_users.all() if not u.local]
mentions = {u for u in self.mention_users.all() if not u.local}
if (
hasattr(self, "reply_parent")
and self.reply_parent
and not self.reply_parent.user.local
):
mentions.append(self.reply_parent.user)
return list(set(mentions))
mentions.add(self.reply_parent.user)
return list(mentions)
@classmethod
def ignore_activity(