Fix topsecret dashboard: limit all sections, show actually recent threads.

Pending requests capped at 25 with total count and "more" link.
Recent threads filtered to last 30 days ordered by created (not changed).
New users capped at 50.
This commit is contained in:
russell@unturf.com 2026-02-05 17:24:07 -05:00
parent f70dfc9ed2
commit 28120caf48
2 changed files with 25 additions and 4 deletions

View file

@ -118,7 +118,7 @@
{# --- PEOPLE WAITING ON US --- #}
<div class="ts-card">
<h4>people waiting on us {% if pending_requests %}<span class="ts-badge">{{ pending_requests|length }}</span>{% endif %}</h4>
<h4>people waiting on us {% if pending_requests_total %}<span class="ts-badge">{{ pending_requests_total }}</span>{% endif %}</h4>
{% if pending_requests %}
<p style="font-size:0.85em; opacity:0.7;">these people chose us over disqus. don't leave them hanging.</p>
{% for req in pending_requests %}
@ -131,6 +131,9 @@
{% endif %}
</div>
{% endfor %}
{% if pending_requests_total > pending_requests|length %}
<p class="meta"><a href="{{ request.route_url('topsecret') }}/namespace-requests">...and {{ pending_requests_total - pending_requests|length }} more</a></p>
{% endif %}
{% else %}
<p>everyone's taken care of. nice work.</p>
{% endif %}

View file

@ -85,19 +85,26 @@ def topsecret_dashboard(request):
total_namespaces = db.query(func.count(Namespace.id)).scalar()
total_nodes = db.query(func.count(Node.id)).scalar()
# --- People waiting on us ---
# --- People waiting on us (oldest first, capped) ---
pending_requests = (
db.query(NamespaceRequest)
.filter(NamespaceRequest.verified == False)
.order_by(NamespaceRequest.created_timestamp.asc())
.limit(25)
.all()
)
pending_requests_total = (
db.query(func.count(NamespaceRequest.id))
.filter(NamespaceRequest.verified == False)
.scalar()
)
# --- New humans (last 7 days) ---
new_users = (
db.query(User)
.filter(User.created > now_ms - seven_days_ms, User.disabled == False)
.order_by(User.created.desc())
.limit(50)
.all()
)
@ -137,8 +144,18 @@ def topsecret_dashboard(request):
.all()
)
# --- Recent root nodes ---
recent_roots = get_topsecret_roots(db).limit(50)
# --- Recent root nodes (created in last 30 days) ---
recent_roots = (
db.query(Node)
.filter(
Node.parent_id == None,
Node.verified == True,
Node.disabled == False,
Node.created > now_ms - thirty_days_ms,
)
.order_by(Node.created.desc())
.limit(50)
)
return {
"the_title": "topsecret",
@ -146,6 +163,7 @@ def topsecret_dashboard(request):
"total_namespaces": total_namespaces,
"total_nodes": total_nodes,
"pending_requests": pending_requests,
"pending_requests_total": pending_requests_total,
"new_users": new_users,
"held_nodes": held_nodes,
"spam_flagged": spam_flagged,