1
0
Fork 0

Use signal for creating group invite notification

This commit is contained in:
Mouse Reeve 2022-07-04 20:24:29 -07:00
parent 03f5a3f2c1
commit aeefd5a3e9
2 changed files with 16 additions and 13 deletions

View file

@ -140,15 +140,6 @@ class GroupMemberInvitation(models.Model):
# make an invitation
super().save(*args, **kwargs)
# now send the invite
model = apps.get_model("bookwyrm.Notification", require_ready=True)
model.notify(
self.user,
self.group.user,
related_group=self.group,
notification_type="INVITE",
)
@transaction.atomic
def accept(self):
"""turn this request into the real deal"""
@ -160,7 +151,7 @@ class GroupMemberInvitation(models.Model):
self.group.user,
self.user,
related_group=self.group,
notification_type="ACCEPT",
notification_type=model.ACCEPT,
)
# let the other members know about it
@ -171,10 +162,9 @@ class GroupMemberInvitation(models.Model):
member,
self.user,
related_group=self.group,
notification_type="JOIN",
notification_type=model.JOIN,
)
def reject(self):
"""generate a Reject for this membership request"""
self.delete()