From 88cc868c90ac9270933a9e55c115ebceb212aa4c Mon Sep 17 00:00:00 2001 From: Eyre_S Date: Wed, 25 May 2022 10:34:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E6=94=B9=20TGUserInfo=20=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E7=9A=84=20display=20name=20=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将 first name 和 last name 合并为 display name 栏目 --- gradle.properties | 2 +- .../cono/morny/GradleProjectConfigures.java | 4 +-- .../morny/util/TelegramUserInformation.java | 30 +++++-------------- 3 files changed, 11 insertions(+), 25 deletions(-) diff --git a/gradle.properties b/gradle.properties index b211493..097003d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ ## Core -VERSION = 0.7.0.11 +VERSION = 0.7.0.12 # dependencies diff --git a/src/main/java/cc/sukazyo/cono/morny/GradleProjectConfigures.java b/src/main/java/cc/sukazyo/cono/morny/GradleProjectConfigures.java index b304e90..c9bbcf6 100644 --- a/src/main/java/cc/sukazyo/cono/morny/GradleProjectConfigures.java +++ b/src/main/java/cc/sukazyo/cono/morny/GradleProjectConfigures.java @@ -4,6 +4,6 @@ package cc.sukazyo.cono.morny; * the final field that will be updated by gradle automatically. */ public class GradleProjectConfigures { - public static final String VERSION = "0.7.0.11"; - public static final long COMPILE_TIMESTAMP = 1653443614307L; + public static final String VERSION = "0.7.0.12"; + public static final long COMPILE_TIMESTAMP = 1653445911339L; } diff --git a/src/main/java/cc/sukazyo/cono/morny/util/TelegramUserInformation.java b/src/main/java/cc/sukazyo/cono/morny/util/TelegramUserInformation.java index 4d0126d..efa3257 100644 --- a/src/main/java/cc/sukazyo/cono/morny/util/TelegramUserInformation.java +++ b/src/main/java/cc/sukazyo/cono/morny/util/TelegramUserInformation.java @@ -60,28 +60,14 @@ public class TelegramUserInformation { if (dataCenter == null) { userInformation.append("\ndatacenter : null"); } else { userInformation.append(String.format("\ndatacenter : %s", escapeHtml(dataCenter))); } } - if (user.firstName() == null) { - userInformation.append("\nfirstname : null"); - } else { - userInformation.append(String.format( - """ - - firstname : - - %s""", - escapeHtml(user.firstName()) - )); - } - if (user.lastName() == null) { - userInformation.append("\nlastname : null"); - } else { - userInformation.append(String.format( - """ - - lastname : - - %s""", - escapeHtml(user.lastName()) - )); - } + userInformation.append(String.format( + """ + + display name : + - %s%s""", + escapeHtml(user.firstName()), + user.lastName()==null ? "" : String.format("\n- %s", escapeHtml(user.lastName())) + )); if (user.languageCode() != null) { userInformation.append(String.format( """