Merge pull request #852 from mouse-reeve/optional-outbox
Makes outbox an optional field on the user table
This commit is contained in:
@ -50,7 +50,7 @@ class User(OrderedCollectionPageMixin, AbstractUser):
|
||||
null=True,
|
||||
blank=True,
|
||||
)
|
||||
outbox = fields.RemoteIdField(unique=True)
|
||||
outbox = fields.RemoteIdField(unique=True, null=True)
|
||||
summary = fields.HtmlField(null=True, blank=True)
|
||||
local = models.BooleanField(default=False)
|
||||
bookwyrm_user = fields.BooleanField(default=True)
|
||||
@ -182,10 +182,10 @@ class User(OrderedCollectionPageMixin, AbstractUser):
|
||||
**kwargs
|
||||
)
|
||||
|
||||
def to_activity(self):
|
||||
def to_activity(self, **kwargs):
|
||||
"""override default AP serializer to add context object
|
||||
idk if this is the best way to go about this"""
|
||||
activity_object = super().to_activity()
|
||||
activity_object = super().to_activity(**kwargs)
|
||||
activity_object["@context"] = [
|
||||
"https://www.w3.org/ns/activitystreams",
|
||||
"https://w3id.org/security/v1",
|
||||
@ -293,10 +293,10 @@ class KeyPair(ActivitypubMixin, BookWyrmModel):
|
||||
self.private_key, self.public_key = create_key_pair()
|
||||
return super().save(*args, **kwargs)
|
||||
|
||||
def to_activity(self):
|
||||
def to_activity(self, **kwargs):
|
||||
"""override default AP serializer to add context object
|
||||
idk if this is the best way to go about this"""
|
||||
activity_object = super().to_activity()
|
||||
activity_object = super().to_activity(**kwargs)
|
||||
del activity_object["@context"]
|
||||
del activity_object["type"]
|
||||
return activity_object
|
||||
@ -360,7 +360,7 @@ def set_remote_server(user_id):
|
||||
actor_parts = urlparse(user.remote_id)
|
||||
user.federated_server = get_or_create_remote_server(actor_parts.netloc)
|
||||
user.save(broadcast=False)
|
||||
if user.bookwyrm_user:
|
||||
if user.bookwyrm_user and user.outbox:
|
||||
get_remote_reviews.delay(user.outbox)
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user