diff --git a/public/s/js/comments.js b/public/s/js/comments.js index 079e6a4..2e32a91 100644 --- a/public/s/js/comments.js +++ b/public/s/js/comments.js @@ -2214,8 +2214,9 @@ class CommentSystem { : ''; const authorUserId = comment.user_id ?? (comment.username && window.f0ckSession && comment.username.toLowerCase() === (window.f0ckSession.user || '').toLowerCase() ? (window.f0ckSession.id || window.f0ckSession.user_id) : null); + const authorUsernameColor = comment.username_color || (comment.username && window.f0ckSession && comment.username.toLowerCase() === (window.f0ckSession.user || '').toLowerCase() ? window.f0ckSession.username_color : null); - return `
${comment.username ? `` : ''}${comment.username ? `` : ''}
${pinnedBadge}${comment.username ? `${this.escapeHtml(comment.display_name || comment.username)}` : 'System'}${contextMarker}${backlinkHtml}
${timeAgo}
${content}
${this.renderCommentAttachments(comment.files, comment.content)}${this.renderCommentPoll(comment.poll, comment.id, comment.username)}
#${comment.id}
${repliesHtml}`; + return `
${comment.username ? `` : ''}${comment.username ? `` : ''}
${pinnedBadge}${comment.username ? `${this.escapeHtml(comment.display_name || comment.username)}` : 'System'}${contextMarker}${backlinkHtml}
${timeAgo}
${content}
${this.renderCommentAttachments(comment.files, comment.content)}${this.renderCommentPoll(comment.poll, comment.id, comment.username)}
#${comment.id}
${repliesHtml}`; } timeAgo(date) { @@ -3595,7 +3596,7 @@ class CommentSystem { display_name: session.display_name || null, avatar: resolvedAvatar, avatar_file: resolvedAvatarFile, - username_color: session.username_color || null, + username_color: (json.comment && json.comment.username_color) || session.username_color || null, banner_file: resolvedBannerFile, banner_position: resolvedBannerPosition, banner_size: resolvedBannerSize, diff --git a/src/inc/routes/comments.mjs b/src/inc/routes/comments.mjs index dedcac2..a1c2ce9 100644 --- a/src/inc/routes/comments.mjs +++ b/src/inc/routes/comments.mjs @@ -665,6 +665,7 @@ export default (router, tpl) => { comment: { ...newComment[0], user_id: req.session.id, + username_color: req.session.username_color || null, content, files: activityFiles, banner_file: bannerOpt.banner_file || req.session.banner_file || null, diff --git a/views/snippets/footer.html b/views/snippets/footer.html index a7dc1ec..6883be1 100644 --- a/views/snippets/footer.html +++ b/views/snippets/footer.html @@ -379,6 +379,7 @@ enable_nsfl: @if(enable_nsfl) true @else false @endif, user: @if(session) "{{ session.user }}" @else null @endif, display_name: @if(session && session.display_name) "{!! session.display_name !!}" @else null @endif, + username_color: @if(session && session.username_color) "{!! session.username_color !!}" @else null @endif, id: @if(session && session.id) {{ session.id }} @else null @endif, user_id: @if(session && session.id) {{ session.id }} @else null @endif, is_admin: @if(session && session.admin) true @else false @endif,