feat(comments): 支持编辑与管理可见历史,采纳展示改用楼层号
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -7,6 +7,7 @@ import {
|
||||
ChevronRight,
|
||||
FileText,
|
||||
FolderOpen,
|
||||
History,
|
||||
Loader2,
|
||||
MessagesSquare,
|
||||
RotateCcw,
|
||||
@@ -36,6 +37,7 @@ import Avatar from "@/components/Avatar";
|
||||
import ConfirmDialog from "@/components/ConfirmDialog";
|
||||
import StaffDeletePostModal from "@/components/StaffDeletePostModal";
|
||||
import DeleteCommentModal from "@/components/DeleteCommentModal";
|
||||
import CommentEditHistoryModal from "@/components/CommentEditHistoryModal";
|
||||
|
||||
const PAGE_SIZE = 15;
|
||||
|
||||
@@ -145,6 +147,7 @@ export default function ContentAdmin({
|
||||
const [staffDeleteBusy, setStaffDeleteBusy] = useState(false);
|
||||
const [staffDeleteComment, setStaffDeleteComment] = useState<AdminContentComment | null>(null);
|
||||
const [staffDeleteCommentBusy, setStaffDeleteCommentBusy] = useState(false);
|
||||
const [historyCommentId, setHistoryCommentId] = useState<number | null>(null);
|
||||
|
||||
const refreshCounts = useCallback(() => {
|
||||
apiAdminContentCounts().then(setCounts).catch(() => {});
|
||||
@@ -570,6 +573,13 @@ export default function ContentAdmin({
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex items-center gap-1 shrink-0">
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-line btn-sm"
|
||||
onClick={() => setHistoryCommentId(c.id)}
|
||||
>
|
||||
<History size={14} /> 历史
|
||||
</button>
|
||||
{c.deleted ? (
|
||||
<>
|
||||
<button
|
||||
@@ -713,6 +723,12 @@ export default function ContentAdmin({
|
||||
.finally(() => setStaffDeleteCommentBusy(false));
|
||||
}}
|
||||
/>
|
||||
|
||||
<CommentEditHistoryModal
|
||||
open={historyCommentId != null}
|
||||
commentId={historyCommentId}
|
||||
onClose={() => setHistoryCommentId(null)}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -657,6 +657,7 @@ export default async function PostDetailPage({ params, searchParams }: PageProps
|
||||
? post.question ?? {
|
||||
solved: false,
|
||||
accepted_comment_id: 0,
|
||||
accepted_floor: 0,
|
||||
can_accept: canManageTyped,
|
||||
can_solve: canManageTyped,
|
||||
can_reopen: false,
|
||||
@@ -728,6 +729,11 @@ export default async function PostDetailPage({ params, searchParams }: PageProps
|
||||
post.bounty?.accepted_comment_id ||
|
||||
0
|
||||
}
|
||||
winnerUserIds={
|
||||
post.lottery?.drawn
|
||||
? (post.lottery.winners || []).map((w) => w.id)
|
||||
: []
|
||||
}
|
||||
/>
|
||||
) : (
|
||||
<section className="panel p-6 sm:p-8 mt-6 text-center" aria-label="评论区">
|
||||
|
||||
Reference in New Issue
Block a user