diff --git a/blueprints/public/routes.py b/blueprints/public/routes.py index ffa4fa2..ab145b3 100644 --- a/blueprints/public/routes.py +++ b/blueprints/public/routes.py @@ -183,25 +183,14 @@ def index(): all_releases = _get_releases() latest_release = all_releases[0] if all_releases else None - # Latest forum activity for homepage (newest reply or topic) - latest_forum_reply = None - latest_forum_topic_for_reply = None + # Newest registered users for homepage + newest_users = [] try: - from database import ForumTopic, ForumReply - # Find the most recent reply - latest_reply = db.query(ForumReply).filter( - ForumReply.is_deleted == False - ).order_by(ForumReply.created_at.desc()).first() - if latest_reply: - latest_forum_reply = latest_reply - latest_forum_topic_for_reply = latest_reply.topic - else: - # No replies — fall back to newest topic - newest_topic = db.query(ForumTopic).filter( - ForumTopic.is_deleted == False - ).order_by(ForumTopic.created_at.desc()).first() - if newest_topic: - latest_forum_topic_for_reply = newest_topic + newest_users = db.query(User).filter( + User.is_active == True, + User.is_verified == True, + User.name != None + ).order_by(User.created_at.desc()).limit(4).all() except Exception: pass @@ -267,8 +256,7 @@ def index(): latest_release=latest_release, company_children=company_children, company_parent=company_parent, - latest_forum_reply=latest_forum_reply, - latest_forum_topic_for_reply=latest_forum_topic_for_reply, + newest_users=newest_users, latest_admitted=latest_admitted, last_meeting=last_meeting, latest_forum_topics=latest_forum_topics, diff --git a/templates/index.html b/templates/index.html index e5381dd..8d44b3a 100755 --- a/templates/index.html +++ b/templates/index.html @@ -1165,7 +1165,7 @@ {% endif %} -{% if upcoming_events or latest_forum_topic_for_reply or latest_admitted %} +{% if upcoming_events or newest_users or latest_admitted %}
@@ -1217,24 +1217,31 @@
- - {% if latest_forum_topic_for_reply %} - -
- 💬 - Najnowszy wpis na forum + + {% if newest_users %} +
+
+ 👤 + Nowi użytkownicy portalu
-
- {{ latest_forum_topic_for_reply.title }} + -
- {% if latest_forum_reply %} - {{ latest_forum_reply.author.name if latest_forum_reply.author else 'Anonim' }} · {{ latest_forum_reply.created_at|local_time('%d.%m.%Y %H:%M') }} - {% else %} - {{ latest_forum_topic_for_reply.author.name if latest_forum_topic_for_reply.author else 'Anonim' }} · {{ latest_forum_topic_for_reply.created_at|local_time('%d.%m.%Y %H:%M') }} - {% endif %} -
- +
{% endif %}