fix: show last reply author in forum cards, not topic author
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
b767a99d73
commit
c49e57965e
@ -210,7 +210,24 @@ def index():
|
||||
).group_by(ForumTopic.id).order_by(
|
||||
func.coalesce(func.max(ForumReply.created_at), ForumTopic.created_at).desc()
|
||||
).limit(2).all()
|
||||
latest_forum_topics = [{'topic': t[0], 'last_activity': t[1]} for t in topics_with_activity]
|
||||
|
||||
for t in topics_with_activity:
|
||||
topic = t[0]
|
||||
last_activity = t[1]
|
||||
# Find the author of the latest reply (or topic author if no replies)
|
||||
latest_reply = db.query(ForumReply).filter(
|
||||
ForumReply.topic_id == topic.id,
|
||||
ForumReply.is_deleted == False
|
||||
).order_by(ForumReply.created_at.desc()).first()
|
||||
if latest_reply:
|
||||
last_author = latest_reply.author
|
||||
else:
|
||||
last_author = topic.author
|
||||
latest_forum_topics.append({
|
||||
'topic': topic,
|
||||
'last_activity': last_activity,
|
||||
'last_author': last_author
|
||||
})
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
||||
@ -1293,7 +1293,7 @@
|
||||
<span class="new-card-badge forum">💬 Forum</span>
|
||||
<div class="new-card-title">{{ item.topic.title }}</div>
|
||||
<div class="new-card-meta">
|
||||
{{ item.topic.author.name if item.topic.author else 'Anonim' }} · {{ item.last_activity|local_time('%d.%m.%Y') }}
|
||||
{{ item.last_author.name if item.last_author else 'Anonim' }} · {{ item.last_activity|local_time('%d.%m.%Y') }}
|
||||
</div>
|
||||
</a>
|
||||
{% endfor %}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user