From c20faed4e398823dd8eb92e8df69bf3b659ba5c2 Mon Sep 17 00:00:00 2001 From: qwqcode Date: Sun, 7 May 2023 18:55:15 +0800 Subject: [PATCH] fix(api): comment IP data loss after editing (#504) Signed-off-by: qwqcode --- server/handler/admin_comment_edit.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/server/handler/admin_comment_edit.go b/server/handler/admin_comment_edit.go index 06876a6d4..6beb647ab 100644 --- a/server/handler/admin_comment_edit.go +++ b/server/handler/admin_comment_edit.go @@ -123,8 +123,13 @@ func AdminCommentEdit(router fiber.Router) { comment.PageKey = p.PageKey } - comment.UA = p.UA - comment.IP = p.IP + if p.UA != "" { + comment.UA = p.UA + } + if p.IP != "" { + comment.IP = p.IP + } + comment.IsCollapsed = p.IsCollapsed comment.IsPinned = p.IsPinned