feat: 改进评论系统管理员识别与样式展示

- 后端评论接口增加 isAdmin 字段,不再依赖前端邮箱比对
- 管理后台评论列表支持 Markdown 渲染并添加相应样式
- 前端组件移除 adminEmail 依赖,改用 comment.isAdmin 字段
- 添加 CSS 样式兼容其他框架导入的表情元素
- 更新文档说明部署流程
This commit is contained in:
anghunk
2026-01-27 15:13:51 +08:00
parent 16aee6a87e
commit 4095473a79
9 changed files with 169 additions and 13 deletions

View File

@@ -39,7 +39,8 @@ export class CommentItem extends Component {
const { comment, isReply, adminEmail, adminBadge } = this.props;
const isPinned = typeof comment.priority === 'number' && comment.priority > 1;
const isReplying = this.props.replyingTo === comment.id;
const isAdmin = adminEmail && comment.email === adminEmail;
// 使用后端返回的 isAdmin 字段,不再依赖前端邮箱比对
const isAdmin = !!comment.isAdmin;
const root = this.createElement('div', {
className: `cwd-comment-item ${isReply ? 'cwd-comment-reply' : ''}`,
@@ -241,7 +242,7 @@ export class CommentItem extends Component {
submitting: this.props.submitting,
currentUser: this.props.currentUser,
onUpdateUserInfo: this.props.onUpdateUserInfo,
adminEmail: this.props.adminEmail,
// adminEmail 已移除
adminBadge: this.props.adminBadge,
enableCommentLike: this.props.enableCommentLike,
onReply: this.props.onReply,

View File

@@ -97,7 +97,7 @@ export class CommentList extends Component {
submitting: this.props.submitting,
currentUser: this.props.currentUser,
onUpdateUserInfo: this.props.onUpdateUserInfo,
adminEmail: this.props.adminEmail,
// adminEmail 已移除,改用 comment.isAdmin 字段
adminBadge: this.props.adminBadge,
enableCommentLike: this.props.enableCommentLike,
onReply: (commentId) => this.handleReply(commentId),