feat: replace forum widget with newest users on homepage
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
Replace 'Najnowszy wpis na forum' (duplicate with Nowe na portalu) with 'Nowi użytkownicy portalu' showing 4 latest registered users with avatars, names, dates and company names. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
3ede8739e8
commit
acc4aff19d
@ -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,
|
||||
|
||||
@ -1165,7 +1165,7 @@
|
||||
{% endif %}
|
||||
|
||||
<!-- Homepage Grid: Events + Forum + New Members -->
|
||||
{% if upcoming_events or latest_forum_topic_for_reply or latest_admitted %}
|
||||
{% if upcoming_events or newest_users or latest_admitted %}
|
||||
<div class="homepage-grid" data-animate="fadeIn">
|
||||
|
||||
<!-- LEFT COLUMN: 2 Events -->
|
||||
@ -1217,24 +1217,31 @@
|
||||
<!-- RIGHT COLUMN: Forum + New Members -->
|
||||
<div style="display: flex; flex-direction: column; gap: var(--spacing-md);">
|
||||
|
||||
<!-- Latest Forum Activity -->
|
||||
{% if latest_forum_topic_for_reply %}
|
||||
<a href="{{ url_for('forum.forum_topic', topic_id=latest_forum_topic_for_reply.id) }}{% if latest_forum_reply %}#reply-{{ latest_forum_reply.id }}{% endif %}" style="text-decoration: none; display: block; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--spacing-md); transition: all 0.2s; min-height: 120px;" onmouseover="this.style.borderColor='var(--primary)';this.style.boxShadow='0 2px 8px rgba(0,0,0,0.08)'" onmouseout="this.style.borderColor='var(--border)';this.style.boxShadow='none'">
|
||||
<div style="display: flex; align-items: center; gap: 8px; margin-bottom: 8px;">
|
||||
<span style="font-size: 1.2rem;">💬</span>
|
||||
<span style="font-size: var(--font-size-xs); font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px;">Najnowszy wpis na forum</span>
|
||||
<!-- Newest Users -->
|
||||
{% if newest_users %}
|
||||
<div style="background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--spacing-md); min-height: 120px;">
|
||||
<div style="display: flex; align-items: center; gap: 8px; margin-bottom: var(--spacing-sm);">
|
||||
<span style="font-size: 1.2rem;">👤</span>
|
||||
<span style="font-size: var(--font-size-xs); font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px;">Nowi użytkownicy portalu</span>
|
||||
</div>
|
||||
<div style="font-weight: 600; color: var(--text-primary); font-size: var(--font-size-base); line-height: 1.4; margin-bottom: 8px;">
|
||||
{{ latest_forum_topic_for_reply.title }}
|
||||
<div style="display: flex; flex-direction: column; gap: 8px;">
|
||||
{% for user in newest_users %}
|
||||
<a href="{{ url_for('public.user_profile', user_id=user.id) }}" style="display: flex; align-items: center; gap: 10px; text-decoration: none; padding: 4px 0;">
|
||||
<div style="width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: var(--font-size-sm); color: white; background: hsl({{ (user.id * 137) % 360 }}, 55%, 50%); flex-shrink: 0;">
|
||||
{% if user.avatar_path %}
|
||||
<img src="{{ url_for('static', filename=user.avatar_path) }}" style="width:100%;height:100%;border-radius:50%;object-fit:cover;">
|
||||
{% else %}
|
||||
{{ (user.name or user.email)[0].upper() }}
|
||||
{% endif %}
|
||||
</div>
|
||||
<div style="flex: 1; min-width: 0;">
|
||||
<div style="font-weight: 500; color: var(--text-primary); font-size: var(--font-size-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">{{ user.name or user.email.split('@')[0] }}</div>
|
||||
<div style="font-size: var(--font-size-xs); color: var(--text-secondary);">{{ user.created_at|local_time('%d.%m.%Y') }}{% if user.company %} · {{ user.company.name }}{% endif %}</div>
|
||||
</div>
|
||||
</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div style="font-size: var(--font-size-sm); color: var(--text-secondary);">
|
||||
{% 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 %}
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<!-- New Members (always visible) -->
|
||||
|
||||
Loading…
Reference in New Issue
Block a user