Serialize model user and book tags to activitypub

This commit is contained in:
Mouse Reeve
2020-11-20 08:14:16 -08:00
parent dfc9262876
commit 73e41d568e
3 changed files with 44 additions and 4 deletions

View File

@ -72,7 +72,14 @@ class ActivitypubMixin:
value = value.remote_id
if isinstance(value, datetime):
value = value.isoformat()
fields[mapping.activity_key] = mapping.activity_formatter(value)
result = mapping.activity_formatter(value)
if mapping.activity_key in fields and \
isinstance(fields[mapping.activity_key], list):
# there are two database fields that map to the same AP list
# this happens in status, which combines user and book tags
fields[mapping.activity_key] += result
else:
fields[mapping.activity_key] = result
if pure:
return self.pure_activity_serializer(