From 8c8b1168d4ece787b9b5445babffe3c91e0b8a4a Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Sun, 29 Aug 2021 08:22:14 -0700 Subject: [PATCH] Support attribution field on boosts --- bookwyrm/models/fields.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bookwyrm/models/fields.py b/bookwyrm/models/fields.py index d7bcd99d..40684531 100644 --- a/bookwyrm/models/fields.py +++ b/bookwyrm/models/fields.py @@ -226,7 +226,12 @@ class PrivacyField(ActivitypubFieldMixin, models.CharField): cc = data.cc # we need to figure out who this is to get their followers link - user_field = "attributedTo" if hasattr(data, "attributedTo") else "owner" + for field in ["attributedTo", "owner", "actor"]: + if hasattr(data, field): + user_field = getattr(data, field) + break + if not user_field: + raise ValidationError("No user field found for privacy", data) user = activitypub.resolve_remote_id(getattr(data, user_field), model="User") if to == [self.public]: