diff --git a/app/boxes.py b/app/boxes.py index 043bf55..2ccd199 100644 --- a/app/boxes.py +++ b/app/boxes.py @@ -32,6 +32,7 @@ from app.config import MANUALLY_APPROVES_FOLLOWERS from app.config import set_moved_to from app.database import AsyncSession from app.outgoing_activities import new_outgoing_activity +from app.source import dedup_tags from app.source import markdownify from app.uploads import upload_to_attachment from app.utils import opengraph @@ -542,7 +543,7 @@ async def send_create( "context": context, "conversation": context, "url": outbox_object_id(note_id), - "tag": tags, + "tag": dedup_tags(tags), "summary": content_warning, "inReplyTo": in_reply_to, "sensitive": is_sensitive, @@ -562,7 +563,7 @@ async def send_create( for tag in tags: if tag["type"] == "Hashtag": tagged_object = models.TaggedOutboxObject( - tag=tag["name"][1:], + tag=tag["name"][1:].lower(), outbox_object_id=outbox_object.id, ) db_session.add(tagged_object) diff --git a/app/main.py b/app/main.py index 68312a1..9a1c7f2 100644 --- a/app/main.py +++ b/app/main.py @@ -763,7 +763,7 @@ async def tag_by_name( _: httpsig.HTTPSigInfo = Depends(httpsig.httpsig_checker), ) -> ActivityPubResponse | templates.TemplateResponse: where = [ - models.TaggedOutboxObject.tag == tag, + models.TaggedOutboxObject.tag == tag.lower(), models.OutboxObject.visibility == ap.VisibilityEnum.PUBLIC, models.OutboxObject.is_deleted.is_(False), ] @@ -789,7 +789,7 @@ async def tag_by_name( return ActivityPubResponse( { "@context": ap.AS_CTX, - "id": BASE_URL + f"/t/{tag}", + "id": BASE_URL + f"/t/{tag.lower()}", "type": "OrderedCollection", "totalItems": tagged_count, "orderedItems": [