mirror of
https://github.com/zulip/zulip.git
synced 2025-11-22 07:21:23 +00:00
Clean up recipient creation for new ZephyrClass objects.
(imported from commit 2aa67fbcc6c01ca1c07f41e0edb6c9efcd336006)
This commit is contained in:
@@ -285,14 +285,11 @@ def add_subscriptions(request):
|
||||
zephyr_class = ZephyrClass.objects.filter(name=sub_name, realm=user_profile.realm)
|
||||
if zephyr_class:
|
||||
zephyr_class = zephyr_class[0]
|
||||
recipient = Recipient.objects.get(type_id=zephyr_class.pk, type="class")
|
||||
else:
|
||||
zephyr_class = ZephyrClass(name=sub_name, realm=user_profile.realm)
|
||||
zephyr_class.save()
|
||||
|
||||
recipient = Recipient.objects.filter(type_id=zephyr_class.pk, type="class")
|
||||
if recipient:
|
||||
recipient = recipient[0]
|
||||
else:
|
||||
recipient = Recipient(type_id=zephyr_class.pk, type="class")
|
||||
recipient.save()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user