fix(company): bust browser cache after logo change via gallery
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

Logo images were cached for 30 days by nginx. After selecting a new logo
from the gallery, the browser still showed the old/placeholder image.
- Add cache-bust query param (?v=timestamp) to logo <img> src
- Update company.last_updated when logo is confirmed
- Use Date.now() redirect instead of reload() after confirm

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Maciej Pienczyn 2026-04-08 15:15:44 +02:00
parent af9871a127
commit a85310ddb7
2 changed files with 6 additions and 2 deletions

View File

@ -649,6 +649,10 @@ def api_fetch_company_logo(company_id):
if action == 'confirm':
index = data.get('index', 0)
ok = service.confirm_candidate(company.slug, index)
if ok:
from datetime import datetime
company.last_updated = datetime.utcnow()
db.commit()
logger.info(f"Logo candidate #{index} confirmed for {company.name} by {current_user.email}")
return jsonify({'success': ok, 'message': 'Logo zapisane' if ok else 'Nie znaleziono kandydata'})

View File

@ -931,7 +931,7 @@
<div class="company-header">
<div class="company-logo-header {{ 'dark-bg' if company.logo_dark_bg else '' }}">
<img src="{{ url_for('static', filename='img/companies/' ~ company.slug ~ '.webp') }}"
<img src="{{ url_for('static', filename='img/companies/' ~ company.slug ~ '.webp') }}?v={{ company.last_updated.strftime('%s') if company.last_updated else '' }}"
alt="{{ company.name }}"
onerror="if(!this.dataset.triedSvg){this.dataset.triedSvg='1';this.src=this.src.replace('.webp','.svg')}else{this.parentElement.style.display='none'}">
</div>
@ -5306,7 +5306,7 @@ function updateLogoStep(stepId, status, message) {
document.getElementById('logoGalleryOverlay').classList.remove('active');
showToast('Logo zapisane!', 'success', 3000);
await sleep(2000);
window.location.reload();
window.location.href = window.location.pathname + '?logo=' + Date.now();
});
// Close gallery on backdrop click