feat: 评论/帖子编辑历史与编辑标记,内容锁定
- 新增 smartDiff 差异计算与 EditHistoryModal 编辑历史弹窗,替换原 CommentEditHistoryModal - 新增 PostEditedMark 编辑标记展示 - 新增内容锁定机制(content_lock)防止并发编辑冲突 - 审核与通知服务适配
This commit is contained in:
@@ -37,6 +37,7 @@ import BadgeChip from "@/components/BadgeChip";
|
||||
import MarkdownBody from "@/components/MarkdownBody";
|
||||
import { publicMarkdownForSeo } from "@/lib/hideBlocks";
|
||||
import PostAttachments from "@/components/PostAttachments";
|
||||
import PostEditedMark from "@/components/PostEditedMark";
|
||||
import PostInteractPanels, { QuestionStatusCard } from "@/components/PostInteractPanels";
|
||||
import AcceptedAnswerCard from "@/components/AcceptedAnswerCard";
|
||||
import { canModerateBoard } from "@/lib/roles";
|
||||
@@ -323,8 +324,7 @@ export default async function PostDetailPage({ params, searchParams }: PageProps
|
||||
const toc = extractToc(publicBody);
|
||||
const headingToc = markdownHeadingToc(toc);
|
||||
const readingMinutes = estimateReadingMinutes(publicBody, post.title.length);
|
||||
const edited =
|
||||
new Date(post.updated_at).getTime() - new Date(post.created_at).getTime() > 60_000;
|
||||
const edited = post.edited ?? false;
|
||||
|
||||
// 侧栏布局:post 范围左右两列(toc 需在下方已就绪)
|
||||
const sidebarLists = sidebarScopeLists(sidebar.config, "post");
|
||||
@@ -560,6 +560,9 @@ export default async function PostDetailPage({ params, searchParams }: PageProps
|
||||
pinned={post.pinned}
|
||||
recommended={post.recommended}
|
||||
status={post.status}
|
||||
createdAt={post.created_at}
|
||||
locked={post.locked}
|
||||
postEditLockHours={publicSettings.post_edit_lock_hours}
|
||||
title={post.title}
|
||||
/>
|
||||
</div>
|
||||
@@ -586,6 +589,16 @@ export default async function PostDetailPage({ params, searchParams }: PageProps
|
||||
<>
|
||||
{" "}
|
||||
· 更新于 <time dateTime={post.updated_at}>{formatDateTime(post.updated_at)}</time>
|
||||
{me.user && (
|
||||
<>
|
||||
{" "}·{" "}
|
||||
<PostEditedMark
|
||||
postId={post.id}
|
||||
currentTitle={post.title}
|
||||
currentContent={post.content || ""}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</p>
|
||||
@@ -670,6 +683,9 @@ export default async function PostDetailPage({ params, searchParams }: PageProps
|
||||
page={commentsData.page}
|
||||
size={commentsData.size}
|
||||
user={me.user}
|
||||
postLocked={post.locked}
|
||||
commentEditLockHours={publicSettings.comment_edit_lock_hours}
|
||||
necroReply={post.necro_reply}
|
||||
acceptMode={acceptMode}
|
||||
acceptedCommentId={
|
||||
post.question?.accepted_comment_id ||
|
||||
|
||||
Reference in New Issue
Block a user