From 4e5d2dee4974c897d472f76e003577127ef5d432 Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Sat, 14 Jan 2023 18:24:36 +0800 Subject: [PATCH] feat(web/blog): username color --- web/app/controllers/subdomain/blog/blog.php | 4 +++- web/js/uoj.js | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/web/app/controllers/subdomain/blog/blog.php b/web/app/controllers/subdomain/blog/blog.php index 5150047..9399add 100644 --- a/web/app/controllers/subdomain/blog/blog.php +++ b/web/app/controllers/subdomain/blog/blog.php @@ -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); diff --git a/web/js/uoj.js b/web/js/uoj.js index 000af78..3b209f3 100644 --- a/web/js/uoj.js +++ b/web/js/uoj.js @@ -1092,7 +1092,7 @@ function showCommentReplies(id, replies) { function(reply) { return $('').append( $('').append( - $('
' + getUserLink(reply.poster, reply.poster_realname) + ':' + reply.content + '
') + $('
' + getUserLink(reply.poster, reply.poster_realname, reply.poster_username_color) + ':' + reply.content + '
') ).append( $('