From ea99f65c26e476b3b10c9ae5047e0f2941e9c019 Mon Sep 17 00:00:00 2001 From: Michael Manfre Date: Sat, 17 Dec 2022 17:42:29 -0500 Subject: Icon and image for Identity could be a list --- users/models/identity.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'users/models') diff --git a/users/models/identity.py b/users/models/identity.py index afec0e7..cf5b711 100644 --- a/users/models/identity.py +++ b/users/models/identity.py @@ -14,7 +14,13 @@ from django.utils.functional import lazy from core.exceptions import ActorMismatchError from core.files import get_remote_file from core.html import sanitize_post, strip_html -from core.ld import canonicalise, format_ld_date, get_list, media_type_from_filename +from core.ld import ( + canonicalise, + format_ld_date, + get_first_image_url, + get_list, + media_type_from_filename, +) from core.models import Config from core.signatures import HttpSignature, RsaKeys from core.uploads import upload_namer @@ -487,8 +493,8 @@ class Identity(StatorModel): self.manually_approves_followers = document.get("manuallyApprovesFollowers") self.public_key = document.get("publicKey", {}).get("publicKeyPem") self.public_key_id = document.get("publicKey", {}).get("id") - self.icon_uri = document.get("icon", {}).get("url") - self.image_uri = document.get("image", {}).get("url") + self.icon_uri = get_first_image_url(document.get("icon", None)) + self.image_uri = get_first_image_url(document.get("image", None)) self.discoverable = document.get("toot:discoverable", True) # Profile links/metadata self.metadata = [] -- cgit v1.2.3