mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-04 00:09:17 +02:00
Resolve "Have an actor for our users"
This commit is contained in:
parent
c335e4d283
commit
6b16a8b963
17 changed files with 308 additions and 9 deletions
|
@ -1,6 +1,8 @@
|
|||
import logging
|
||||
import mimetypes
|
||||
import urllib.parse
|
||||
|
||||
from django.core.exceptions import ObjectDoesNotExist
|
||||
from django.core.paginator import Paginator
|
||||
from django.db import transaction
|
||||
from rest_framework import serializers
|
||||
|
@ -63,6 +65,15 @@ class ActorSerializer(serializers.Serializer):
|
|||
ret["endpoints"] = {}
|
||||
if instance.shared_inbox_url:
|
||||
ret["endpoints"]["sharedInbox"] = instance.shared_inbox_url
|
||||
try:
|
||||
if instance.user.avatar:
|
||||
ret["icon"] = {
|
||||
"type": "Image",
|
||||
"mediaType": mimetypes.guess_type(instance.user.avatar.path)[0],
|
||||
"url": utils.full_url(instance.user.avatar.crop["400x400"].url),
|
||||
}
|
||||
except ObjectDoesNotExist:
|
||||
pass
|
||||
return ret
|
||||
|
||||
def prepare_missing_fields(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue