fix: 管理删评对公众剥离作者身份,评论者本人仍可见原文
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -16,7 +16,8 @@ export default async function AcceptedAnswerCard({
|
||||
/** 解决/采纳时刻;缺省用答案创建时间 */
|
||||
solvedAt?: string;
|
||||
}) {
|
||||
const name = answer.user.nickname || answer.user.username || "用户";
|
||||
const author = answer.user;
|
||||
const name = author ? author.nickname || author.username || "用户" : "";
|
||||
const isQuestion = variant === "question";
|
||||
const title = isQuestion ? "问答" : "悬赏";
|
||||
const statusLabel = isQuestion ? "已解决" : "已采纳";
|
||||
@@ -48,42 +49,73 @@ export default async function AcceptedAnswerCard({
|
||||
<CheckCircle2 size={12} strokeWidth={2.25} aria-hidden />
|
||||
{answerLabel}
|
||||
</span>
|
||||
<Link href={`/u/${answer.user.id}`} className="shrink-0" aria-label={name}>
|
||||
<Avatar name={name} src={answer.user.avatar || undefined} size={32} />
|
||||
</Link>
|
||||
<div className="min-w-0 flex flex-col gap-0.5">
|
||||
<Link
|
||||
href={`/u/${answer.user.id}`}
|
||||
className="truncate text-[13.5px] font-semibold hover:text-[var(--accent)] transition-colors"
|
||||
style={{ color: "var(--ink)" }}
|
||||
>
|
||||
{name}
|
||||
</Link>
|
||||
<p className="meta text-[12px] flex items-center gap-1.5 flex-wrap !mb-0">
|
||||
<time dateTime={answer.created_at}>
|
||||
{new Date(answer.created_at).toLocaleString("zh-CN")}
|
||||
</time>
|
||||
{answer.floor > 0 && (
|
||||
<>
|
||||
<span aria-hidden>·</span>
|
||||
<a
|
||||
href={`#comment-${answer.id}`}
|
||||
className="hover:underline"
|
||||
style={{ color: "var(--accent)" }}
|
||||
>
|
||||
#{answer.floor}
|
||||
</a>
|
||||
</>
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
{author ? (
|
||||
<>
|
||||
<Link href={`/u/${author.id}`} className="shrink-0" aria-label={name}>
|
||||
<Avatar name={name} src={author.avatar || undefined} size={32} />
|
||||
</Link>
|
||||
<div className="min-w-0 flex flex-col gap-0.5">
|
||||
<Link
|
||||
href={`/u/${author.id}`}
|
||||
className="truncate text-[13.5px] font-semibold hover:text-[var(--accent)] transition-colors"
|
||||
style={{ color: "var(--ink)" }}
|
||||
>
|
||||
{name}
|
||||
</Link>
|
||||
<p className="meta text-[12px] flex items-center gap-1.5 flex-wrap !mb-0">
|
||||
<time dateTime={answer.created_at}>
|
||||
{new Date(answer.created_at).toLocaleString("zh-CN")}
|
||||
</time>
|
||||
{answer.floor > 0 && (
|
||||
<>
|
||||
<span aria-hidden>·</span>
|
||||
<a
|
||||
href={`#comment-${answer.id}`}
|
||||
className="hover:underline"
|
||||
style={{ color: "var(--accent)" }}
|
||||
>
|
||||
#{answer.floor}
|
||||
</a>
|
||||
</>
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
</>
|
||||
) : (
|
||||
<div className="min-w-0 flex flex-col gap-0.5">
|
||||
<p className="meta text-[12px] flex items-center gap-1.5 flex-wrap !mb-0">
|
||||
<time dateTime={answer.created_at}>
|
||||
{new Date(answer.created_at).toLocaleString("zh-CN")}
|
||||
</time>
|
||||
{answer.floor > 0 && (
|
||||
<>
|
||||
<span aria-hidden>·</span>
|
||||
<a
|
||||
href={`#comment-${answer.id}`}
|
||||
className="hover:underline"
|
||||
style={{ color: "var(--accent)" }}
|
||||
>
|
||||
#{answer.floor}
|
||||
</a>
|
||||
</>
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="j13-accepted-answer__body">
|
||||
{answer.deleted ? (
|
||||
<p className="meta text-[14px]" style={{ color: "var(--ink-3)" }}>
|
||||
该答案已被删除
|
||||
</p>
|
||||
<>
|
||||
<p className="meta text-[14px]" style={{ color: "var(--ink-3)" }}>
|
||||
该答案已被删除
|
||||
</p>
|
||||
{answer.content ? (
|
||||
<div className="mt-2">
|
||||
<MarkdownBody content={answer.content} className="prose-content prose-comment" />
|
||||
</div>
|
||||
) : null}
|
||||
</>
|
||||
) : (
|
||||
<MarkdownBody content={answer.content} className="prose-content prose-comment" />
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user