forked from halo-dev/halo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add author pages for theme-side (halo-dev#2923)
#### What type of PR is this? /kind feature /area core #### What this PR does / why we need it: 为主题端新增作者页面 see halo-dev#2837 for more detail #### Which issue(s) this PR fixes: Fixes halo-dev#2837 #### Special notes for your reviewer: /cc @halo-dev/sig-halo #### Does this PR introduce a user-facing change? ```release-note 主题端支持作者页面 ```
- Loading branch information
Showing
17 changed files
with
476 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
95 changes: 89 additions & 6 deletions
95
src/main/java/run/halo/app/core/extension/reconciler/UserReconciler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package run.halo.app.theme.finders.vo; | ||
|
||
import java.util.List; | ||
import lombok.Builder; | ||
import lombok.Value; | ||
import org.apache.commons.lang3.ObjectUtils; | ||
import run.halo.app.core.extension.User; | ||
import run.halo.app.extension.MetadataOperator; | ||
import run.halo.app.infra.utils.JsonUtils; | ||
|
||
@Value | ||
@Builder | ||
public class UserVo { | ||
MetadataOperator metadata; | ||
|
||
User.UserSpec spec; | ||
|
||
User.UserStatus status; | ||
|
||
/** | ||
* Converts to {@link UserVo} from {@link User}. | ||
* | ||
* @param user user extension | ||
* @return user value object. | ||
*/ | ||
public static UserVo from(User user) { | ||
User.UserStatus statusCopy = | ||
JsonUtils.deepCopy(ObjectUtils.defaultIfNull(user.getStatus(), new User.UserStatus())); | ||
statusCopy.setLoginHistories(List.of()); | ||
statusCopy.setLastLoginAt(null); | ||
|
||
User.UserSpec userSpecCopy = JsonUtils.deepCopy(user.getSpec()); | ||
userSpecCopy.setPassword("[PROTECTED]"); | ||
return UserVo.builder() | ||
.metadata(user.getMetadata()) | ||
.spec(userSpecCopy) | ||
.status(statusCopy) | ||
.build(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.