Format reviews in outbox

This commit is contained in:
Mouse Reeve 2020-02-19 12:13:08 -08:00
parent ff25152afe
commit 400ddaa5fd
2 changed files with 7 additions and 3 deletions

View file

@ -2,7 +2,7 @@
from uuid import uuid4 from uuid import uuid4
from urllib.parse import urlencode from urllib.parse import urlencode
from .status import get_status from .status import get_status, get_review
def get_outbox(user, size): def get_outbox(user, size):
''' helper function for creating an outbox ''' ''' helper function for creating an outbox '''
@ -21,7 +21,11 @@ def get_outbox_page(user, page_id, statuses, max_id, min_id):
} }
for status in statuses: for status in statuses:
page['orderedItems'].append(get_status(status)) if status.status_type == 'Review':
status_activity = get_review(status)
else:
status_activity = get_status(status)
page['orderedItems'].append(status_activity)
if max_id: if max_id:
page['next'] = user.outbox + '?' + \ page['next'] = user.outbox + '?' + \

View file

@ -40,7 +40,7 @@ def outbox(request, username):
statuses = models.Status.objects.filter( statuses = models.Status.objects.filter(
user=user, user=user,
**filters **filters
).all()[:limit] ).select_subclasses().all()[:limit]
return JsonResponse( return JsonResponse(
activitypub.get_outbox_page(user, page_id, statuses, max_id, min_id) activitypub.get_outbox_page(user, page_id, statuses, max_id, min_id)