mirror of https://github.com/zulip/zulip.git
Cleanup style of filter_by_subscriptions.
(imported from commit 4bc62dcc97eeb98147dd73163c75a142eaf5d3c9)
This commit is contained in:
parent
7f6d085ab6
commit
f39c203d2c
|
@ -188,11 +188,14 @@ def get_huddle(id_list):
|
|||
def filter_by_subscriptions(zephyrs, user):
|
||||
userprofile = UserProfile.objects.get(user=user)
|
||||
subscribed_zephyrs = []
|
||||
subscriptions = [sub.recipient for sub in Subscription.objects.filter(userprofile=userprofile, active=True)]
|
||||
subscriptions = [sub.recipient for sub in
|
||||
Subscription.objects.filter(userprofile=userprofile, active=True)]
|
||||
for zephyr in zephyrs:
|
||||
# If you are subscribed to the personal or class, or if you sent the personal, you can see the zephyr.
|
||||
# If you are subscribed to the personal or class, or if you
|
||||
# sent the personal, you can see the zephyr.
|
||||
if (zephyr.recipient in subscriptions) or \
|
||||
(zephyr.recipient.type == "personal" and zephyr.sender == userprofile):
|
||||
(zephyr.recipient.type == "personal" and
|
||||
zephyr.sender == userprofile):
|
||||
subscribed_zephyrs.append(zephyr)
|
||||
|
||||
return subscribed_zephyrs
|
||||
|
|
Loading…
Reference in New Issue