Makes cc fields optional

Plus a bit of cleanup in comments and to: fields
This commit is contained in:
Mouse Reeve 2021-04-15 16:21:54 -07:00
parent addbf6771e
commit addcc59d7f

View file

@ -1,4 +1,4 @@
""" undo wrapper activity """ """ activities that do things """
from dataclasses import dataclass, field from dataclasses import dataclass, field
from typing import List from typing import List
from django.apps import apps from django.apps import apps
@ -9,14 +9,13 @@ from .ordered_collection import CollectionItem
@dataclass(init=False) @dataclass(init=False)
class Verb(ActivityObject): class Verb(ActivityObject):
"""generic fields for activities - maybe an unecessary level of """generic fields for activities """
abstraction but w/e"""
actor: str actor: str
object: ActivityObject object: ActivityObject
def action(self): 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() self.object.to_model()
@ -24,8 +23,8 @@ class Verb(ActivityObject):
class Create(Verb): class Create(Verb):
""" Create activity """ """ Create activity """
to: List to: List[str]
cc: List cc: List[str] = field(default_factory=lambda: [])
signature: Signature = None signature: Signature = None
type: str = "Create" type: str = "Create"
@ -34,8 +33,8 @@ class Create(Verb):
class Delete(Verb): class Delete(Verb):
""" Create activity """ """ Create activity """
to: List to: List[str]
cc: List cc: List[str] = field(default_factory=lambda: [])
type: str = "Delete" type: str = "Delete"
def action(self): def action(self):
@ -48,7 +47,7 @@ class Delete(Verb):
class Update(Verb): class Update(Verb):
""" Update activity """ """ Update activity """
to: List to: List[str]
type: str = "Update" type: str = "Update"
def action(self): def action(self):