Fixes logic error in detecting changed fields when serializing

This commit is contained in:
Mouse Reeve 2021-08-03 12:21:11 -07:00
parent b059cbdd18
commit ebc0680288
2 changed files with 2 additions and 1 deletions

View file

@ -80,7 +80,7 @@ class ActivitypubFieldMixin:
return False
# the field is unchanged
if getattr(instance, self.name) == formatted:
if hasattr(instance, self.name) and getattr(instance, self.name) == formatted:
return False
setattr(instance, self.name, formatted)

View file

@ -21,6 +21,7 @@ from bookwyrm import models
@patch("bookwyrm.activitystreams.ActivityStream.add_status")
@patch("bookwyrm.suggested_users.rerank_user_task.delay")
@patch("bookwyrm.suggested_users.remove_user_task.delay")
@patch("bookwyrm.suggested_users.rerank_suggestions_task.delay")
class BaseActivity(TestCase):
"""the super class for model-linked activitypub dataclasses"""