Changeset ab544fd in Klonkt


Ignore:
Timestamp:
06/14/2026 04:49:24 PM (3 months ago)
Author:
roboburr <roboburr@…>
Branches:
main
Children:
6150acb
Parents:
a64f642
Message:

fix: PrutFolio header + roster show the SITE OWNER's photo, not the viewer's

Bug: profile-header.ejs used user.avatar_url (the LOGGED-IN viewer) as the
profile photo -> every PrutFolio showed the picture of whoever was looking
("studionoord" appeared to change along with the viewer). Now: site.profile_photo
-> avatar of the site owner -> music/initial fallback; never the viewer.
siteOwnerAvatar comes from render.js. Roster (hub overview) likewise: per-site
owner avatar instead of nothing.

Result: an artist's account avatar (/account) is immediately their PrutFolio
photo; one "own picture" that is correct, per user.

Co-Authored-By: Claude <noreply@…>

Location:
src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/middleware/render.js

    ra64f642 rab544fd  
    4343    db.prepare('SELECT 1 FROM sites WHERE owner_id = ? LIMIT 1').get(_u.id));
    4444
     45  // De avatar van de SITE-EIGENAAR (niet de kijker!) — voor de PrutFolio-kop,
     46  // zodat de artiest z'n eigen account-foto als sitefoto kan gebruiken.
     47  const _site = data.site || res.locals.site || null;
     48  const siteOwnerAvatar = (_site && _site.owner_id)
     49    ? (db.prepare('SELECT avatar_url FROM users WHERE id = ?').get(_site.owner_id)?.avatar_url || null)
     50    : null;
     51
    4552  // Common locals
    4653  const locals = {
    4754    user: _u,
    4855    userOwnsSite,
    49     site: data.site || res.locals.site || null,
     56    siteOwnerAvatar,
     57    site: _site,
    5058    audioTracks: data.audioTracks || res.locals.audioTracks || [],
    5159    siteUrlBase: res.locals.siteUrlBase || '',
  • src/routes/hub.js

    ra64f642 rab544fd  
    3838  const artists = db.prepare(`
    3939    SELECT s.slug, s.title, s.tagline, s.profile_photo, s.accent,
     40           u.avatar_url AS owner_avatar,
    4041           (SELECT COUNT(*) FROM posts WHERE site_id = s.id AND status = 'published') AS post_count
    4142    FROM sites s
     43    LEFT JOIN users u ON u.id = s.owner_id
    4244    ORDER BY s.created_at ASC
    4345  `).all();
  • src/views/pages/hub-home.ejs

    ra64f642 rab544fd  
    3838        <% artists.forEach(function(a){ %>
    3939          <a class="roster-card" href="/user/<%= a.slug %>">
    40             <span class="roster-avatar"<% if (a.profile_photo) { %> style="background-image:url('<%= a.profile_photo %>')"<% } else { %> style="background:<%= a.accent || 'var(--accent)' %>;color:#fff"<% } %>>
    41               <% if (!a.profile_photo) { %><%= (a.title || a.slug).charAt(0).toUpperCase() %><% } %>
     40            <% var _ava = a.profile_photo || a.owner_avatar; %>
     41            <span class="roster-avatar"<% if (_ava) { %> style="background-image:url('<%= _ava %>')"<% } else { %> style="background:<%= a.accent || 'var(--accent)' %>;color:#fff"<% } %>>
     42              <% if (!_ava) { %><%= (a.title || a.slug).charAt(0).toUpperCase() %><% } %>
    4243            </span>
    4344            <span class="roster-name"><%= a.title %></span>
  • src/views/partials/profile-header.ejs

    ra64f642 rab544fd  
    3737       hx-push-url="<%= (typeof siteUrlBase !== 'undefined' && siteUrlBase) ? siteUrlBase : '' %>/"
    3838       hx-indicator="#pcms-loading" aria-label="Home">
    39       <% if (typeof user !== 'undefined' && user && user.avatar_url) { %>
    40         <img src="<%= user.avatar_url %>" alt="">
    41       <% } else if (site.profile_photo) { %>
     39      <% if (site.profile_photo) { %>
    4240        <img src="<%= site.profile_photo %>" alt="">
     41      <% } else if (typeof siteOwnerAvatar !== 'undefined' && siteOwnerAvatar) { %>
     42        <img src="<%= siteOwnerAvatar %>" alt="">
    4343      <% } else if (site.enable_audio_player) { %>
    4444        <span class="profile-photo-fallback profile-photo-fallback--music" aria-hidden="true">
Note: See TracChangeset for help on using the changeset viewer.