ji
This commit is contained in:
@@ -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 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 `<div class="${commentClass} ${isDeleted ? 'deleted' : ''} ${isPinned ? 'pinned' : ''}" id="c${comment.id}" ${bannerStyle}><div class="comment-avatar">${comment.username ? `<a href="/user/${comment.username}">` : ''}<img src="${comment.avatar_file ? `/a/${comment.avatar_file}` : (comment.avatar ? `/t/${comment.avatar}.webp` : '/a/default.png')}">${comment.username ? `</a>` : ''}</div><div class="comment-body"><div class="comment-header"><div class="comment-header-left">${pinnedBadge}${comment.username ? `<a href="/user/${comment.username}" class="comment-author" tooltip="ID: ${authorUserId ?? ''}" ${comment.username_color ? `style="color: ${comment.username_color}"` : ''}>${this.escapeHtml(comment.display_name || comment.username)}</a>` : '<span class="comment-author">System</span>'}${contextMarker}${backlinkHtml}</div><a href="#c${comment.id}" class="comment-time timeago" tooltip="${fullDate}" data-iso="${isoDate}" data-id="${comment.id}" data-username="${comment.username}" data-display="${this.escapeHtml(comment.display_name || '')}">${timeAgo}</a></div><div class="comment-content" data-raw="${this.escapeHtml(comment.content)}">${content}</div>${this.renderCommentAttachments(comment.files, comment.content)}${this.renderCommentPoll(comment.poll, comment.id, comment.username)}<div class="comment-footer"><div class="comment-footer-right"><div class="comment-actions">${!isDeleted && currentUserId ? `<button class="reply-btn" data-id="${comment.id}" data-username="${comment.username}" data-display="${this.escapeHtml(comment.display_name || '')}" title="Reply"><i class="fa-solid fa-reply"></i></button><button class="quote-btn" data-id="${comment.id}" data-username="${comment.username}" data-display="${this.escapeHtml(comment.display_name || '')}" title="Quote with Text"><i class="fa-solid fa-quote-left"></i></button><button class="report-comment-btn" data-id="${comment.id}" title="Report Comment" style="background:none;border:none;color:inherit;cursor:pointer;opacity:0.75;padding:0;"><i class="fa-solid fa-triangle-exclamation"></i></button>` : ''}${adminButtons}${userDeleteButton}</div></div></div></div><a href="#c${comment.id}" class="comment-permalink" title="Permalink" data-id="${comment.id}" data-username="${comment.username}" data-display="${this.escapeHtml(comment.display_name || '')}">#${comment.id}</a></div>${repliesHtml}`;
|
return `<div class="${commentClass} ${isDeleted ? 'deleted' : ''} ${isPinned ? 'pinned' : ''}" id="c${comment.id}" ${bannerStyle}><div class="comment-avatar">${comment.username ? `<a href="/user/${comment.username}">` : ''}<img src="${comment.avatar_file ? `/a/${comment.avatar_file}` : (comment.avatar ? `/t/${comment.avatar}.webp` : '/a/default.png')}">${comment.username ? `</a>` : ''}</div><div class="comment-body"><div class="comment-header"><div class="comment-header-left">${pinnedBadge}${comment.username ? `<a href="/user/${comment.username}" class="comment-author" tooltip="ID: ${authorUserId ?? ''}" ${authorUsernameColor ? `style="color: ${authorUsernameColor}"` : ''}>${this.escapeHtml(comment.display_name || comment.username)}</a>` : '<span class="comment-author">System</span>'}${contextMarker}${backlinkHtml}</div><a href="#c${comment.id}" class="comment-time timeago" tooltip="${fullDate}" data-iso="${isoDate}" data-id="${comment.id}" data-username="${comment.username}" data-display="${this.escapeHtml(comment.display_name || '')}">${timeAgo}</a></div><div class="comment-content" data-raw="${this.escapeHtml(comment.content)}">${content}</div>${this.renderCommentAttachments(comment.files, comment.content)}${this.renderCommentPoll(comment.poll, comment.id, comment.username)}<div class="comment-footer"><div class="comment-footer-right"><div class="comment-actions">${!isDeleted && currentUserId ? `<button class="reply-btn" data-id="${comment.id}" data-username="${comment.username}" data-display="${this.escapeHtml(comment.display_name || '')}" title="Reply"><i class="fa-solid fa-reply"></i></button><button class="quote-btn" data-id="${comment.id}" data-username="${comment.username}" data-display="${this.escapeHtml(comment.display_name || '')}" title="Quote with Text"><i class="fa-solid fa-quote-left"></i></button><button class="report-comment-btn" data-id="${comment.id}" title="Report Comment" style="background:none;border:none;color:inherit;cursor:pointer;opacity:0.75;padding:0;"><i class="fa-solid fa-triangle-exclamation"></i></button>` : ''}${adminButtons}${userDeleteButton}</div></div></div></div><a href="#c${comment.id}" class="comment-permalink" title="Permalink" data-id="${comment.id}" data-username="${comment.username}" data-display="${this.escapeHtml(comment.display_name || '')}">#${comment.id}</a></div>${repliesHtml}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
timeAgo(date) {
|
timeAgo(date) {
|
||||||
@@ -3595,7 +3596,7 @@ class CommentSystem {
|
|||||||
display_name: session.display_name || null,
|
display_name: session.display_name || null,
|
||||||
avatar: resolvedAvatar,
|
avatar: resolvedAvatar,
|
||||||
avatar_file: resolvedAvatarFile,
|
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_file: resolvedBannerFile,
|
||||||
banner_position: resolvedBannerPosition,
|
banner_position: resolvedBannerPosition,
|
||||||
banner_size: resolvedBannerSize,
|
banner_size: resolvedBannerSize,
|
||||||
|
|||||||
@@ -665,6 +665,7 @@ export default (router, tpl) => {
|
|||||||
comment: {
|
comment: {
|
||||||
...newComment[0],
|
...newComment[0],
|
||||||
user_id: req.session.id,
|
user_id: req.session.id,
|
||||||
|
username_color: req.session.username_color || null,
|
||||||
content,
|
content,
|
||||||
files: activityFiles,
|
files: activityFiles,
|
||||||
banner_file: bannerOpt.banner_file || req.session.banner_file || null,
|
banner_file: bannerOpt.banner_file || req.session.banner_file || null,
|
||||||
|
|||||||
@@ -379,6 +379,7 @@
|
|||||||
enable_nsfl: @if(enable_nsfl) true @else false @endif,
|
enable_nsfl: @if(enable_nsfl) true @else false @endif,
|
||||||
user: @if(session) "{{ session.user }}" @else null @endif,
|
user: @if(session) "{{ session.user }}" @else null @endif,
|
||||||
display_name: @if(session && session.display_name) "{!! session.display_name !!}" @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,
|
id: @if(session && session.id) {{ session.id }} @else null @endif,
|
||||||
user_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,
|
is_admin: @if(session && session.admin) true @else false @endif,
|
||||||
|
|||||||
Reference in New Issue
Block a user