fix(feed): join remote_actors to get proper handle and avatar for remote authors
This commit is contained in:
@@ -95,15 +95,23 @@ fn feed_select(viewer: Option<uuid::Uuid>) -> String {
|
|||||||
t.in_reply_to_id, t.in_reply_to_url, t.ap_id AS t_ap_id,
|
t.in_reply_to_id, t.in_reply_to_url, t.ap_id AS t_ap_id,
|
||||||
t.visibility, t.content_warning, t.sensitive, t.local AS t_local,
|
t.visibility, t.content_warning, t.sensitive, t.local AS t_local,
|
||||||
t.created_at AS thought_created_at, t.updated_at,
|
t.created_at AS thought_created_at, t.updated_at,
|
||||||
u.id AS author_id, u.username, u.email, u.password_hash,
|
u.id AS author_id,
|
||||||
u.display_name, u.bio, u.avatar_url, u.header_url, u.custom_css,
|
CASE WHEN NOT u.local AND ra.handle IS NOT NULL AND ra.handle != ''
|
||||||
|
THEN '@' || ra.handle ELSE u.username END AS username,
|
||||||
|
u.email, u.password_hash,
|
||||||
|
COALESCE(ra.display_name, u.display_name) AS display_name,
|
||||||
|
u.bio,
|
||||||
|
COALESCE(ra.avatar_url, u.avatar_url) AS avatar_url,
|
||||||
|
u.header_url, u.custom_css,
|
||||||
u.local AS author_local, u.ap_id AS u_ap_id, u.inbox_url,
|
u.local AS author_local, u.ap_id AS u_ap_id, u.inbox_url,
|
||||||
u.created_at AS author_created_at, u.updated_at AS author_updated_at,
|
u.created_at AS author_created_at, u.updated_at AS author_updated_at,
|
||||||
(SELECT COUNT(*) FROM likes l WHERE l.thought_id=t.id) AS like_count,
|
(SELECT COUNT(*) FROM likes l WHERE l.thought_id=t.id) AS like_count,
|
||||||
(SELECT COUNT(*) FROM boosts b WHERE b.thought_id=t.id) AS boost_count,
|
(SELECT COUNT(*) FROM boosts b WHERE b.thought_id=t.id) AS boost_count,
|
||||||
(SELECT COUNT(*) FROM thoughts r WHERE r.in_reply_to_id=t.id) AS reply_count,
|
(SELECT COUNT(*) FROM thoughts r WHERE r.in_reply_to_id=t.id) AS reply_count,
|
||||||
{viewer_checks}
|
{viewer_checks}
|
||||||
FROM thoughts t JOIN users u ON u.id=t.user_id"
|
FROM thoughts t
|
||||||
|
JOIN users u ON u.id=t.user_id
|
||||||
|
LEFT JOIN remote_actors ra ON u.ap_id = ra.url"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user