From addcc59d7fa9eef940c26cd91669abc357730b12 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Thu, 15 Apr 2021 16:21:54 -0700 Subject: [PATCH] Makes cc fields optional Plus a bit of cleanup in comments and to: fields --- bookwyrm/activitypub/verbs.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/bookwyrm/activitypub/verbs.py b/bookwyrm/activitypub/verbs.py index c3c84ee5..f79afdca 100644 --- a/bookwyrm/activitypub/verbs.py +++ b/bookwyrm/activitypub/verbs.py @@ -1,4 +1,4 @@ -""" undo wrapper activity """ +""" activities that do things """ from dataclasses import dataclass, field from typing import List from django.apps import apps @@ -9,14 +9,13 @@ from .ordered_collection import CollectionItem @dataclass(init=False) class Verb(ActivityObject): - """generic fields for activities - maybe an unecessary level of - abstraction but w/e""" + """generic fields for activities """ actor: str object: ActivityObject def action(self): - """ usually we just want to save, this can be overridden as needed """ + """ usually we just want to update and save """ self.object.to_model() @@ -24,8 +23,8 @@ class Verb(ActivityObject): class Create(Verb): """ Create activity """ - to: List - cc: List + to: List[str] + cc: List[str] = field(default_factory=lambda: []) signature: Signature = None type: str = "Create" @@ -34,8 +33,8 @@ class Create(Verb): class Delete(Verb): """ Create activity """ - to: List - cc: List + to: List[str] + cc: List[str] = field(default_factory=lambda: []) type: str = "Delete" def action(self): @@ -48,7 +47,7 @@ class Delete(Verb): class Update(Verb): """ Update activity """ - to: List + to: List[str] type: str = "Update" def action(self):