From 770f6728f60b50a8bed3f73e3b052f1a57f1262d Mon Sep 17 00:00:00 2001 From: Andrew Godwin Date: Fri, 16 Dec 2022 19:45:39 -0700 Subject: Fix mastodon LD namespace Fixes #179 --- activities/models/emoji.py | 1 - activities/models/post.py | 10 ++++------ activities/models/post_attachment.py | 2 +- 3 files changed, 5 insertions(+), 8 deletions(-) (limited to 'activities') diff --git a/activities/models/emoji.py b/activities/models/emoji.py index 96b9725..c310423 100644 --- a/activities/models/emoji.py +++ b/activities/models/emoji.py @@ -211,7 +211,6 @@ class Emoji(StatorModel): def to_ap_tag(self): """ Return this Emoji as an ActivityPub Tag - http://joinmastodon.org/ns#Emoji """ return { "id": self.object_uri or f"https://{settings.MAIN_DOMAIN}/emoji/{self.pk}/", diff --git a/activities/models/post.py b/activities/models/post.py index e8698d3..c32ed55 100644 --- a/activities/models/post.py +++ b/activities/models/post.py @@ -672,7 +672,7 @@ class Post(StatorModel): post.mentions.add(mention_identity) elif tag["type"].lower() == "hashtag": post.hashtags.append(tag["name"].lower().lstrip("#")) - elif tag["type"].lower() == "http://joinmastodon.org/ns#emoji": + elif tag["type"].lower() == "toot:emoji": emoji = Emoji.by_ap_tag(post.author.domain, tag, create=True) post.emojis.add(emoji) else: @@ -689,10 +689,8 @@ class Post(StatorModel): # These have no IDs, so we have to wipe them each time post.attachments.all().delete() for attachment in get_list(data, "attachment"): - if "http://joinmastodon.org/ns#focalPoint" in attachment: - focal_x, focal_y = attachment[ - "http://joinmastodon.org/ns#focalPoint" - ]["@list"] + if "toot:focalPoint" in attachment: + focal_x, focal_y = attachment["toot:focalPoint"]["@list"] else: focal_x, focal_y = None, None post.attachments.create( @@ -701,7 +699,7 @@ class Post(StatorModel): name=attachment.get("name"), width=attachment.get("width"), height=attachment.get("height"), - blurhash=attachment.get("http://joinmastodon.org/ns#blurhash"), + blurhash=attachment.get("toot:blurhash"), focal_x=focal_x, focal_y=focal_y, ) diff --git a/activities/models/post_attachment.py b/activities/models/post_attachment.py index 3b1f425..7fa125a 100644 --- a/activities/models/post_attachment.py +++ b/activities/models/post_attachment.py @@ -96,7 +96,7 @@ class PostAttachment(StatorModel): "width": self.width, "height": self.height, "mediaType": self.mimetype, - "http://joinmastodon.org/ns#focalPoint": [0, 0], + "toot:focalPoint": [0, 0], } ### Mastodon Client API ### -- cgit v1.2.3