forked from mirrors/bookwyrm
minor style fixes
This commit is contained in:
parent
d1d339225c
commit
8cf7e4405d
6 changed files with 13 additions and 12 deletions
|
@ -44,10 +44,9 @@ class ActivityObject:
|
|||
type: str
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
''' this lets you pass in an object with fields
|
||||
that aren't in the dataclass, which it ignores.
|
||||
Any field in the dataclass is required or has a
|
||||
default value '''
|
||||
''' this lets you pass in an object with fields that aren't in the
|
||||
dataclass, which it ignores. Any field in the dataclass is required or
|
||||
has a default value '''
|
||||
for field in fields(self):
|
||||
try:
|
||||
value = kwargs[field.name]
|
||||
|
@ -59,7 +58,7 @@ class ActivityObject:
|
|||
|
||||
|
||||
def to_model(self, model, instance=None):
|
||||
''' convert from an activity to a model '''
|
||||
''' convert from an activity to a model instance '''
|
||||
if not isinstance(self, model.activity_serializer):
|
||||
raise TypeError('Wrong activity type for model')
|
||||
|
||||
|
|
|
@ -52,7 +52,6 @@ class Work(Book):
|
|||
type: str = 'Work'
|
||||
|
||||
|
||||
|
||||
@dataclass(init=False)
|
||||
class Author(ActivityObject):
|
||||
''' author of a book '''
|
||||
|
|
|
@ -6,6 +6,7 @@ from .base_activity import ActivityObject, Image
|
|||
|
||||
@dataclass(init=False)
|
||||
class Tombstone(ActivityObject):
|
||||
''' the placeholder for a deleted status '''
|
||||
url: str
|
||||
published: str
|
||||
deleted: str
|
||||
|
@ -23,7 +24,6 @@ class Note(ActivityObject):
|
|||
cc: List[str]
|
||||
content: str
|
||||
replies: Dict
|
||||
# TODO: this is wrong???
|
||||
attachment: List[Image] = field(default=lambda: [])
|
||||
sensitive: bool = False
|
||||
type: str = 'Note'
|
||||
|
|
|
@ -13,7 +13,6 @@ def get_public_recipients(user, software=None):
|
|||
''' everybody and their public inboxes '''
|
||||
followers = user.followers.filter(local=False)
|
||||
if software:
|
||||
# TODO: eventually we may want to handle particular software differently
|
||||
followers = followers.filter(bookwyrm_user=(software == 'bookwyrm'))
|
||||
|
||||
# we want shared inboxes when available
|
||||
|
@ -36,7 +35,6 @@ def broadcast(sender, activity, software=None, \
|
|||
# start with parsing the direct recipients
|
||||
recipients = [u.inbox for u in direct_recipients or []]
|
||||
# and then add any other recipients
|
||||
# TODO: other kinds of privacy
|
||||
if privacy == 'public':
|
||||
recipients += get_public_recipients(sender, software=software)
|
||||
broadcast_task.delay(
|
||||
|
@ -55,7 +53,6 @@ def broadcast_task(sender_id, activity, recipients):
|
|||
try:
|
||||
sign_and_send(sender, activity, recipient)
|
||||
except requests.exceptions.HTTPError as e:
|
||||
# TODO: maybe keep track of users who cause errors
|
||||
errors.append({
|
||||
'error': str(e),
|
||||
'recipient': recipient,
|
||||
|
|
|
@ -6,7 +6,6 @@ from bookwyrm.tasks import app
|
|||
|
||||
def password_reset_email(reset_code):
|
||||
''' generate a password reset email '''
|
||||
# TODO; this should be tempalted
|
||||
site = models.SiteSettings.get()
|
||||
send_email.delay(
|
||||
reset_code.user.email,
|
||||
|
|
|
@ -11,7 +11,14 @@ localname_regex = r'(?P<username>[\w\-_]+)'
|
|||
user_path = r'^user/%s' % username_regex
|
||||
local_user_path = r'^user/%s' % localname_regex
|
||||
|
||||
status_types = ['status', 'review', 'comment', 'quotation', 'boost', 'generatedstatus']
|
||||
status_types = [
|
||||
'status',
|
||||
'review',
|
||||
'comment',
|
||||
'quotation',
|
||||
'boost',
|
||||
'generatedstatus'
|
||||
]
|
||||
status_path = r'%s/(%s)/(?P<status_id>\d+)' % \
|
||||
(local_user_path, '|'.join(status_types))
|
||||
|
||||
|
|
Loading…
Reference in a new issue