Compare commits

..
Author SHA1 Message Date
Typosaurus 08b791d67a ticket #113 attempt 1 2026-07-23 03:18:03 +00:00
8 changed files with 44 additions and 77 deletions
File diff suppressed because one or more lines are too long
-1
View File
@@ -42,7 +42,6 @@ def init_db():
_index(db, "posts", "idx_posts_created_at", ["created_at"])
_index(db, "posts", "idx_posts_topic", ["topic"])
_index(db, "posts", "idx_posts_slug", ["slug"])
_index(db, "posts", "idx_posts_project_uid", ["project_uid"])
if "posts" in tables:
posts_table = get_table("posts")
if not posts_table.has_column("tags"):
-10
View File
@@ -216,15 +216,6 @@ async def project_detail(request: Request, project_slug: str):
if parent
else None
)
posts_table = get_table("posts")
project_posts = list(
posts_table.find(
project_uid=project["uid"],
deleted_at=None,
order_by=["-created_at"],
)
)
return respond(
request,
"project_detail.html",
@@ -244,7 +235,6 @@ async def project_detail(request: Request, project_slug: str):
"forked_from": forked_from,
"fork_count": count_forks(project["uid"]),
"file_count": count_files(project["uid"]),
"project_posts": project_posts,
},
),
model=ProjectDetailOut,
+3 -1
View File
@@ -4,6 +4,8 @@ from __future__ import annotations
from typing import Any, Optional
from pydantic import Field
from devplacepy.schemas.base import _Out
@@ -62,7 +64,7 @@ class PollOut(_Out):
class BadgeOut(_Out):
name: Optional[str] = None
name: Optional[str] = Field(None, alias="badge_name")
created_at: Optional[str] = None
-1
View File
@@ -163,7 +163,6 @@ class ProjectDetailOut(_Out):
forked_from: Optional[dict] = None
fork_count: int = 0
file_count: int = 0
project_posts: list[PostOut] = []
class GistsOut(_Out):
-47
View File
@@ -313,50 +313,3 @@
color: var(--text-muted);
margin-bottom: 0.5rem;
}
.project-devlog {
margin-top: 2rem;
padding-top: 1.5rem;
border-top: 1px solid var(--border);
}
.devlog-list {
list-style: none;
padding: 0;
margin: 0;
}
.devlog-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0.5rem 0;
border-bottom: 1px solid var(--border);
gap: 1rem;
}
.devlog-item:last-child {
border-bottom: none;
}
.devlog-link {
color: var(--text-primary);
text-decoration: none;
font-weight: 500;
}
.devlog-link:hover {
color: var(--accent);
}
.devlog-date {
font-size: 0.8125rem;
color: var(--text-muted);
white-space: nowrap;
flex-shrink: 0;
}
.devlog-empty {
color: var(--text-muted);
font-size: 0.875rem;
}
-16
View File
@@ -170,22 +170,6 @@
{% endcall %}
{% endif %}
<div class="project-devlog">
<h2 class="project-section-label">Devlog</h2>
{% if project_posts %}
<ul class="devlog-list">
{% for post in project_posts %}
<li class="devlog-item">
<a href="/posts/{{ post['slug'] }}" class="devlog-link">{{ render_title(post['title']) }}</a>
<span class="devlog-date">{{ local_dt(post['created_at'], 'date') }}</span>
</li>
{% endfor %}
</ul>
{% else %}
<p class="devlog-empty">No posts yet for this project.</p>
{% endif %}
</div>
{% with target_uid=project['uid'], target_type="project" %}
{% include "_comment_section.html" %}
{% endwith %}
+40
View File
@@ -407,3 +407,43 @@ def test_viewing_profile_marks_notification_read(app_server):
refresh_snapshot()
assert bool(get_table("notifications").find_one(uid=notif_uid)["read"]) is True
def test_profile_json_badge_names_non_null(app_server):
from datetime import datetime, timezone
from uuid import uuid4
from devplacepy.database import get_table, refresh_snapshot
from devplacepy.utils import generate_uid
uid = str(uuid4())
username = f"badge_{uid[:8]}"
get_table("users").insert(
{
"uid": uid,
"username": username,
"email": f"{uid[:8]}@badge.test",
"password_hash": "x",
"role": "Member",
"is_active": True,
"created_at": datetime.now(timezone.utc).isoformat(),
}
)
badge_uid = generate_uid()
get_table("badges").insert(
{
"uid": badge_uid,
"user_uid": uid,
"badge_name": "On Fire",
"created_at": datetime.now(timezone.utc).isoformat(),
}
)
refresh_snapshot()
r = requests.get(
f"{BASE_URL}/profile/{username}", headers={"Accept": "application/json"}
)
assert r.status_code == 200
body = r.json()
for badge in body.get("badges", []):
assert badge["name"] is not None, f"Badge name is None: {badge}"
assert badge["name"] == "On Fire"