diff --git a/bookwyrm/models/fields.py b/bookwyrm/models/fields.py index bc10156b6..55de1fab2 100644 --- a/bookwyrm/models/fields.py +++ b/bookwyrm/models/fields.py @@ -263,6 +263,7 @@ class ManyToManyField(ActivitypubFieldMixin, models.ManyToManyField): if formatted is None or formatted is MISSING: return getattr(instance, self.name).set(formatted) + instance.save(broadcast=False) def field_to_activity(self, value): if self.link_only: diff --git a/bookwyrm/models/status.py b/bookwyrm/models/status.py index 7091fd0b5..d2768e286 100644 --- a/bookwyrm/models/status.py +++ b/bookwyrm/models/status.py @@ -52,13 +52,15 @@ class Status(OrderedCollectionPageMixin, BookWyrmModel): serialize_reverse_fields = [('attachments', 'attachment', 'id')] deserialize_reverse_fields = [('attachments', 'attachment')] + def save(self, *args, **kwargs): ''' save and notify ''' super().save(*args, **kwargs) notification_model = apps.get_model( 'bookwyrm.Notification', require_ready=True) - if self.reply_parent and self.reply_parent.user.local: + if self.reply_parent and self.reply_parent.user != self.user and \ + self.reply_parent.user.local: notification_model.objects.create( user=self.reply_parent.user, notification_type='REPLY', @@ -68,7 +70,8 @@ class Status(OrderedCollectionPageMixin, BookWyrmModel): for mention_user in self.mention_users.all(): # avoid double-notifying about this status if not mention_user.local or notification_model.objects.filter( - related_status=self, related_user=mention_user).exists(): + user=mention_user, related_status=self, + related_user=self.user).exists(): continue notification_model.objects.create( user=mention_user,