refactor(calendar): link all users as pill badges, not just KRS-linked ones
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
Changed person linking to use User.id → /profil/<user_id> instead of requiring Person record (person_id). This makes 57 additional users linkable as green pill badges in event details and descriptions. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
3dfd01f9d0
commit
3b7e528aca
@ -138,16 +138,16 @@ def _enrich_event_description(db, html):
|
||||
paragraphs = html.split('\n\n')
|
||||
html = ''.join(f'<p>{p.replace(chr(10), "<br>")}</p>' for p in paragraphs if p.strip())
|
||||
|
||||
# Build replacement maps — persons
|
||||
members = db.query(User.name, User.person_id).filter(
|
||||
User.person_id.isnot(None),
|
||||
# Build replacement maps — persons (all users with a name)
|
||||
members = db.query(User.id, User.name).filter(
|
||||
User.name.isnot(None),
|
||||
).all()
|
||||
members = sorted(members, key=lambda m: len(m.name), reverse=True)
|
||||
|
||||
person_map = {}
|
||||
for m in members:
|
||||
person_map[m.name] = flask_url_for('person_detail', person_id=m.person_id)
|
||||
if m.name not in person_map: # first match wins (longest name already sorted)
|
||||
person_map[m.name] = flask_url_for('user_profile', user_id=m.id)
|
||||
|
||||
# Build replacement maps — companies
|
||||
from database import Company
|
||||
@ -247,17 +247,16 @@ def event(event_id):
|
||||
EventAttendee.user_id == current_user.id
|
||||
).first()
|
||||
|
||||
# Find speaker's person_id or company by matching name
|
||||
speaker_person_id = None
|
||||
# Find speaker as user or company
|
||||
speaker_user_id = None
|
||||
speaker_company_slug = None
|
||||
from database import User, Company
|
||||
if event.speaker_name:
|
||||
speaker_user = db.query(User).filter(
|
||||
User.name == event.speaker_name,
|
||||
User.person_id.isnot(None)
|
||||
).first()
|
||||
if speaker_user:
|
||||
speaker_person_id = speaker_user.person_id
|
||||
speaker_user_id = speaker_user.id
|
||||
else:
|
||||
# Try matching as company name
|
||||
speaker_company = db.query(Company).filter(
|
||||
@ -275,7 +274,7 @@ def event(event_id):
|
||||
return render_template('calendar/event.html',
|
||||
event=event,
|
||||
user_attending=user_attending,
|
||||
speaker_person_id=speaker_person_id,
|
||||
speaker_user_id=speaker_user_id,
|
||||
speaker_company_slug=speaker_company_slug,
|
||||
enriched_description=enriched_description,
|
||||
)
|
||||
|
||||
@ -455,8 +455,8 @@
|
||||
<div>
|
||||
<div class="info-label">Prelegent</div>
|
||||
<div class="info-value">
|
||||
{% if speaker_person_id %}
|
||||
<a href="{{ url_for('person_detail', person_id=speaker_person_id) }}" class="person-link">{{ event.speaker_name }}</a>
|
||||
{% if speaker_user_id %}
|
||||
<a href="{{ url_for('user_profile', user_id=speaker_user_id) }}" class="person-link">{{ event.speaker_name }}</a>
|
||||
{% elif speaker_company_slug %}
|
||||
<a href="{{ url_for('company_detail_by_slug', slug=speaker_company_slug) }}" class="company-link">{{ event.speaker_name }}</a>
|
||||
{% else %}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user