fix(评论组件): 修复管理员标识逻辑和默认值问题

移除CWDComments中adminBadge的默认值'博主',仅在CommentItem中当adminBadge存在时才显示管理员标识
This commit is contained in:
anghunk
2026-01-20 20:44:09 +08:00
parent 4aaaea78c4
commit e01e0d9f6a
3 changed files with 4 additions and 4 deletions

File diff suppressed because one or more lines are too long

View File

@@ -30,10 +30,10 @@ export class CommentItem extends Component {
this.childCommentItems = []; // 缓存嵌套回复的 CommentItem 实例
}
render() {
render() {
const { comment, isReply, adminEmail, adminBadge } = this.props;
const isReplying = this.props.replyingTo === comment.id;
const isAdmin = adminEmail && comment.email === adminEmail;
const isAdmin = adminEmail && adminBadge && comment.email === adminEmail;
const root = this.createElement('div', {
className: `cwd-comment-item ${isReply ? 'cwd-comment-reply' : ''}`,

View File

@@ -289,7 +289,7 @@ export class CWDComments {
replyError: state.replyError,
submitting: state.submitting,
adminEmail: this.config.adminEmail,
adminBadge: this.config.adminBadge || '博主',
adminBadge: this.config.adminBadge,
onRetry: () => this.store.loadComments(),
onReply: (commentId) => this.store.startReply(commentId),
onSubmitReply: (commentId) => this.store.submitReply(commentId),