feat: 评论/帖子编辑历史与编辑标记,内容锁定
- 新增 smartDiff 差异计算与 EditHistoryModal 编辑历史弹窗,替换原 CommentEditHistoryModal - 新增 PostEditedMark 编辑标记展示 - 新增内容锁定机制(content_lock)防止并发编辑冲突 - 审核与通知服务适配
This commit is contained in:
@@ -25,6 +25,7 @@ import {
|
||||
apiAdminContentPosts,
|
||||
apiAdminContentComments,
|
||||
apiAdminSoftDeletePost,
|
||||
apiCommentHistory,
|
||||
apiAdminRestorePost,
|
||||
apiAdminPurgePost,
|
||||
apiAdminSoftDeleteComment,
|
||||
@@ -48,7 +49,7 @@ import AutolinkText from "@/components/AutolinkText";
|
||||
import ConfirmDialog from "@/components/ConfirmDialog";
|
||||
import StaffDeletePostModal from "@/components/StaffDeletePostModal";
|
||||
import DeleteCommentModal from "@/components/DeleteCommentModal";
|
||||
import CommentEditHistoryModal from "@/components/CommentEditHistoryModal";
|
||||
import EditHistoryModal from "@/components/EditHistoryModal";
|
||||
import {
|
||||
AdminEmpty,
|
||||
AdminPageHeader,
|
||||
@@ -320,6 +321,7 @@ export default function ContentAdmin({
|
||||
const [staffDeleteComment, setStaffDeleteComment] = useState<AdminContentComment | null>(null);
|
||||
const [staffDeleteCommentBusy, setStaffDeleteCommentBusy] = useState(false);
|
||||
const [historyCommentId, setHistoryCommentId] = useState<number | null>(null);
|
||||
const [historyCommentContent, setHistoryCommentContent] = useState("");
|
||||
|
||||
const refreshCounts = useCallback(() => {
|
||||
apiAdminContentCounts().then(setCounts).catch(() => {});
|
||||
@@ -710,11 +712,17 @@ export default function ContentAdmin({
|
||||
onReject={() => askReject("comments", c.id)}
|
||||
/>
|
||||
) : null}
|
||||
<ContentAction
|
||||
label="历史"
|
||||
icon={<History size={13} />}
|
||||
onClick={() => setHistoryCommentId(c.id)}
|
||||
/>
|
||||
{/* 未编辑(无修订快照)的评论不展示历史入口,避免打开空记录 */}
|
||||
{c.edited ? (
|
||||
<ContentAction
|
||||
label="历史"
|
||||
icon={<History size={13} />}
|
||||
onClick={() => {
|
||||
setHistoryCommentContent(c.content);
|
||||
setHistoryCommentId(c.id);
|
||||
}}
|
||||
/>
|
||||
) : null}
|
||||
{c.deleted ? (
|
||||
<>
|
||||
{canModerateAuthor({ role: viewerRole }, c.user?.role) ? (
|
||||
@@ -930,9 +938,14 @@ export default function ContentAdmin({
|
||||
}}
|
||||
/>
|
||||
|
||||
<CommentEditHistoryModal
|
||||
<EditHistoryModal
|
||||
open={historyCommentId != null}
|
||||
commentId={historyCommentId}
|
||||
title="评论编辑历史"
|
||||
currentContent={historyCommentContent}
|
||||
fetchPage={(p, s) => {
|
||||
if (historyCommentId == null) return Promise.reject(new Error("未选择评论"));
|
||||
return apiCommentHistory(historyCommentId, p, s);
|
||||
}}
|
||||
onClose={() => setHistoryCommentId(null)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user