From 767aa53a22a4f0d23bb76fcb16a9944f01388548 Mon Sep 17 00:00:00 2001 From: AirboZH Date: Wed, 11 Oct 2023 17:12:34 +0800 Subject: [PATCH] pref: improve the structure of ContributorVo (#4645) (#4705) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #### What type of PR is this? /kind improvement /kind api-change #### What this PR does / why we need it: 优化ContributorVo格式,支持更多信息。 #### Which issue(s) this PR fixes: Fixes #4645 #### Special notes for your reviewer: none #### Does this PR introduce a user-facing change? ```release-note contributorFinder 支持返回用户元数据、注册信息、用户权限等。 ``` --- .../java/run/halo/app/theme/finders/vo/ContributorVo.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/application/src/main/java/run/halo/app/theme/finders/vo/ContributorVo.java b/application/src/main/java/run/halo/app/theme/finders/vo/ContributorVo.java index 99eb599f1e..06396bc750 100644 --- a/application/src/main/java/run/halo/app/theme/finders/vo/ContributorVo.java +++ b/application/src/main/java/run/halo/app/theme/finders/vo/ContributorVo.java @@ -4,6 +4,7 @@ import lombok.ToString; import lombok.Value; import run.halo.app.core.extension.User; +import run.halo.app.extension.MetadataOperator; /** * A value object for {@link run.halo.app.core.extension.User}. @@ -14,7 +15,8 @@ @Value @ToString @Builder -public class ContributorVo { +public class ContributorVo implements ExtensionVoOperator { + String name; String displayName; @@ -25,6 +27,8 @@ public class ContributorVo { String permalink; + MetadataOperator metadata; + /** * Convert {@link User} to {@link ContributorVo}. * @@ -39,6 +43,7 @@ public static ContributorVo from(User user) { .avatar(user.getSpec().getAvatar()) .bio(user.getSpec().getBio()) .permalink(permalink) + .metadata(user.getMetadata()) .build(); } }