feat: add clickable activity cards with comment anchor links to profile tab

Add `url` field to profile activity items so post cards link to `/posts/{slug}` and comment cards link to the parent post with a `#comment-{uid}` anchor, matching notification click behavior. Include the shared `_card_link.html` overlay in the template, fix XP bar rendering for missing `xp` key, and add API + e2e tests verifying the link structure and navigation.
This commit is contained in:
2026-07-04 20:24:59 +00:00
parent c79dfd0291
commit 7002b23eeb
11 changed files with 213 additions and 13 deletions
+3
View File
@@ -26,6 +26,7 @@ from devplacepy.database import (
get_user_media,
search_users_by_username,
mark_notifications_read_by_target,
resolve_object_url,
)
from devplacepy.content import can_view_project, enrich_items
from devplacepy.utils import (
@@ -209,6 +210,7 @@ async def profile_page(
"time_ago": time_ago(p["created_at"]),
"created_at": p["created_at"],
"uid": p["uid"],
"url": resolve_object_url("post", p["uid"]),
}
)
comments_table = get_table("comments")
@@ -228,6 +230,7 @@ async def profile_page(
"created_at": c["created_at"],
"uid": target_uid,
"target_type": target_type,
"url": f"{resolve_object_url(target_type, target_uid)}#comment-{c['uid']}",
}
)
activities.sort(key=lambda a: a["created_at"], reverse=True)