Changeset 82079ad in Klonkt for src/routes/posts.js


Ignore:
Timestamp:
06/24/2026 12:31:43 PM (3 months ago)
Author:
Robin Genis <roboburr@…>
Branches:
main
Children:
3d7312a
Parents:
52ea6df
Message:

feat: one identity — user avatar falls back to the site photo everywhere

When a user has no own account avatar, display their site's profile photo across
the account page, top nav (render.js) and comments. No DB copy → stays in sync.

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/routes/posts.js

    r52ea6df r82079ad  
    661661  const commentRows = db.prepare(`
    662662    SELECT c.id, c.parent_comment_id, c.content, c.status, c.created_at,
    663            c.author_id, u.username AS author_username, u.avatar_url AS author_avatar
     663           c.author_id, u.username AS author_username,
     664           COALESCE(u.avatar_url, (SELECT profile_photo FROM sites WHERE owner_id = u.id AND profile_photo IS NOT NULL ORDER BY is_primary DESC, created_at ASC LIMIT 1)) AS author_avatar
    664665    FROM comments c JOIN users u ON u.id = c.author_id
    665666    WHERE c.post_id = ? AND c.status = 'approved'
Note: See TracChangeset for help on using the changeset viewer.