forked from forks/microblog.pub
Make hashtag case insensitive
This commit is contained in:
parent
5eaa0f291b
commit
c8a9793638
2 changed files with 5 additions and 4 deletions
|
@ -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)
|
||||
|
|
|
@ -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": [
|
||||
|
|
Loading…
Reference in a new issue