mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-18 06:06:34 +00:00
Support multiple possible fields that indicate user ownership
This commit is contained in:
parent
9c4fd1e602
commit
a5dcc0e5e4
2 changed files with 3 additions and 1 deletions
|
@ -226,7 +226,8 @@ class PrivacyField(ActivitypubFieldMixin, models.CharField):
|
||||||
cc = data.cc
|
cc = data.cc
|
||||||
|
|
||||||
# we need to figure out who this is to get their followers link
|
# we need to figure out who this is to get their followers link
|
||||||
user = activitypub.resolve_remote_id(data.attributedTo, model="User")
|
user_field = "attributedTo" if hasattr(data, "attributedTo") else "owner"
|
||||||
|
user = activitypub.resolve_remote_id(getattr(data, user_field), model="User")
|
||||||
|
|
||||||
if to == [self.public]:
|
if to == [self.public]:
|
||||||
setattr(instance, self.name, "public")
|
setattr(instance, self.name, "public")
|
||||||
|
|
|
@ -11,6 +11,7 @@ from bookwyrm.settings import USE_HTTPS, DOMAIN
|
||||||
# pylint: disable=missing-function-docstring
|
# pylint: disable=missing-function-docstring
|
||||||
class User(TestCase):
|
class User(TestCase):
|
||||||
protocol = "https://" if USE_HTTPS else "http://"
|
protocol = "https://" if USE_HTTPS else "http://"
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
with patch("bookwyrm.suggested_users.rerank_suggestions_task.delay"):
|
with patch("bookwyrm.suggested_users.rerank_suggestions_task.delay"):
|
||||||
self.user = models.User.objects.create_user(
|
self.user = models.User.objects.create_user(
|
||||||
|
|
Loading…
Reference in a new issue