Runs black
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
''' Handle user activity '''
|
||||
""" Handle user activity """
|
||||
from django.db import transaction
|
||||
from django.utils import timezone
|
||||
|
||||
@ -7,14 +7,14 @@ from bookwyrm.sanitize_html import InputHtmlParser
|
||||
|
||||
|
||||
def delete_status(status):
|
||||
''' replace the status with a tombstone '''
|
||||
""" replace the status with a tombstone """
|
||||
status.deleted = True
|
||||
status.deleted_date = timezone.now()
|
||||
status.save()
|
||||
|
||||
|
||||
def create_generated_note(user, content, mention_books=None, privacy='public'):
|
||||
''' a note created by the app about user activity '''
|
||||
def create_generated_note(user, content, mention_books=None, privacy="public"):
|
||||
""" a note created by the app about user activity """
|
||||
# sanitize input html
|
||||
parser = InputHtmlParser()
|
||||
parser.feed(content)
|
||||
@ -22,11 +22,7 @@ def create_generated_note(user, content, mention_books=None, privacy='public'):
|
||||
|
||||
with transaction.atomic():
|
||||
# create but don't save
|
||||
status = models.GeneratedNote(
|
||||
user=user,
|
||||
content=content,
|
||||
privacy=privacy
|
||||
)
|
||||
status = models.GeneratedNote(user=user, content=content, privacy=privacy)
|
||||
# we have to save it to set the related fields, but hold off on telling
|
||||
# folks about it because it is not ready
|
||||
status.save(broadcast=False)
|
||||
|
Reference in New Issue
Block a user