From 46544451d46f9e0971121d802bcdff77bd0000ab Mon Sep 17 00:00:00 2001 From: Levi Bard Date: Thu, 23 May 2024 08:56:54 +0200 Subject: [PATCH] Add as:Hashtag to activitypub context --- bookwyrm/activitypub/base_activity.py | 5 ++++- bookwyrm/models/user.py | 1 + bookwyrm/tests/models/test_user_model.py | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/bookwyrm/activitypub/base_activity.py b/bookwyrm/activitypub/base_activity.py index efc9d8da2..b995788c3 100644 --- a/bookwyrm/activitypub/base_activity.py +++ b/bookwyrm/activitypub/base_activity.py @@ -250,7 +250,10 @@ class ActivityObject: pass data = {k: v for (k, v) in data.items() if v is not None and k not in omit} if "@context" not in omit: - data["@context"] = "https://www.w3.org/ns/activitystreams" + data["@context"] = [ + "https://www.w3.org/ns/activitystreams", + {"Hashtag": "as:Hashtag"}, + ] return data diff --git a/bookwyrm/models/user.py b/bookwyrm/models/user.py index e2671b07f..bc728d5f2 100644 --- a/bookwyrm/models/user.py +++ b/bookwyrm/models/user.py @@ -327,6 +327,7 @@ class User(OrderedCollectionPageMixin, AbstractUser): "https://w3id.org/security/v1", { "manuallyApprovesFollowers": "as:manuallyApprovesFollowers", + "Hashtag": "as:Hashtag", "schema": "http://schema.org#", "PropertyValue": "schema:PropertyValue", "value": "schema:value", diff --git a/bookwyrm/tests/models/test_user_model.py b/bookwyrm/tests/models/test_user_model.py index 3147f95e3..2e122872d 100644 --- a/bookwyrm/tests/models/test_user_model.py +++ b/bookwyrm/tests/models/test_user_model.py @@ -95,6 +95,7 @@ class User(TestCase): "PropertyValue": "schema:PropertyValue", "alsoKnownAs": {"@id": "as:alsoKnownAs", "@type": "@id"}, "manuallyApprovesFollowers": "as:manuallyApprovesFollowers", + "Hashtag": "as:Hashtag", "movedTo": {"@id": "as:movedTo", "@type": "@id"}, "schema": "http://schema.org#", "value": "schema:value",