fix: post/reply avatars not updating after avatar change

Feed, PostDetail and ReplyList rendered ui-avatars fallback from
username only, ignoring avatar_url from the posts/replies API. Now
use p.avatar_url / r.avatar_url when present.
This commit is contained in:
lezi-fun committed 2026-08-10 15:23:05 +08:00
1 parent d5e56c0a20
commit 599b6f3435
3 files changed
+3 -3

No files matched your search

+1 -1
View File
@@ -85,7 +85,7 @@ export default function Feed({ onOpenModal, onReport }) {
<div style={{ fontSize: 12, color: 'var(--primary)', fontWeight: 600, marginBottom: 4 }}>📌 置顶</div>
)}
<div className="post-header">
<img src={avatar(p.username)} className="post-avatar" alt="" />
<img src={p.avatar_url || avatar(p.username)} className="post-avatar" alt="" />
<span
className="post-username"
style={{ cursor: 'pointer', color: 'var(--primary)' }}
+1 -1
View File
@@ -95,7 +95,7 @@ export default function PostDetail({ postId }) {
<div id="postDetailContent" style={{ maxWidth: 700, margin: '0 auto', width: '100%' }}>
<div className="post-detail-card">
<div className="post-header">
<img src={avatar(post.username)} className="post-avatar" alt="" />
<img src={post.avatar_url || avatar(post.username)} className="post-avatar" alt="" />
<span
className="post-username"
style={{ cursor: 'pointer', color: 'var(--primary)' }}
+1 -1
View File
@@ -74,7 +74,7 @@ export default function ReplyList({ postId, onRefresh }) {
return (
<div key={r.id} className="reply-item">
<div className="reply-header">
<img src={avatar(r.username)} className="reply-avatar" alt="" />
<img src={r.avatar_url || avatar(r.username)} className="reply-avatar" alt="" />
<span
className="reply-username"
style={{ cursor: 'pointer', color: 'var(--primary)' }}