feat(web/blog): username color

This commit is contained in:
Baoshuo Ren 2023-01-14 18:24:36 +08:00
parent 1ebcda02d6
commit 4e5d2dee49
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
2 changed files with 4 additions and 2 deletions

View File

@ -201,7 +201,9 @@ $comments_pag = new Paginator([
"order by id"
]);
foreach ($replies as $idx => $reply) {
$replies[$idx]['poster_realname'] = UOJUser::query($reply['poster'])['realname'];
$reply_user = UOJUser::query($reply['poster']);
$replies[$idx]['poster_realname'] = $reply_user['realname'];
$replies[$idx]['poster_username_color'] = UOJUser::getUserColor($reply_user);
$replies[$idx]['content'] = getCommentContentToDisplay($reply);
}
$replies_json = json_encode($replies);

View File

@ -1092,7 +1092,7 @@ function showCommentReplies(id, replies) {
function(reply) {
return $('<tr id="' + 'comment-' + reply.id + '" />').append(
$('<td />').append(
$('<div class="comtbox6">' + getUserLink(reply.poster, reply.poster_realname) + '' + reply.content + '</div>')
$('<div class="comtbox6">' + getUserLink(reply.poster, reply.poster_realname, reply.poster_username_color) + '' + reply.content + '</div>')
).append(
$('<ul class="' + (isBootstrap5Page ? 'text-end mb-0' : 'text-right bot-buffer-no') + ' list-inline" />').append(
'<li>' + '<small class="text-muted">' + reply.post_time + '</small>' + '</li>'