From 935dda282e082c63e9628d3c8874be203c4cbc6c Mon Sep 17 00:00:00 2001 From: johnniang Date: Wed, 22 May 2019 23:37:12 +0800 Subject: [PATCH 1/5] Fix option updation trigger bug --- .../halo/app/event/freemarker/FreemarkerConfigAwareListener.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/run/halo/app/event/freemarker/FreemarkerConfigAwareListener.java b/src/main/java/run/halo/app/event/freemarker/FreemarkerConfigAwareListener.java index 72ee60ecb..f1b8bbe5d 100644 --- a/src/main/java/run/halo/app/event/freemarker/FreemarkerConfigAwareListener.java +++ b/src/main/java/run/halo/app/event/freemarker/FreemarkerConfigAwareListener.java @@ -78,6 +78,7 @@ public class FreemarkerConfigAwareListener { log.debug("Received option updated event"); loadOptionsConfig(); + loadThemeConfig(); } From 99c11ac57db69cb500461e5507d4e98b69afa96f Mon Sep 17 00:00:00 2001 From: johnniang Date: Wed, 22 May 2019 23:44:03 +0800 Subject: [PATCH 2/5] Change openjdk:8-jdk-alpine to openjdk:8-jre-alpine in Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 266446422..8cb50cdc5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM openjdk:8-jdk-alpine +FROM openjdk:8-jre-alpine VOLUME /tmp From 527d8bf390d26d5fc559345fafdeede610c23265 Mon Sep 17 00:00:00 2001 From: johnniang Date: Wed, 22 May 2019 23:46:26 +0800 Subject: [PATCH 3/5] Ignore GithubTest an GitTest --- src/test/java/run/halo/app/utils/GitTest.java | 2 ++ src/test/java/run/halo/app/utils/GithubTest.java | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/test/java/run/halo/app/utils/GitTest.java b/src/test/java/run/halo/app/utils/GitTest.java index af62fc5c2..75558c3c5 100644 --- a/src/test/java/run/halo/app/utils/GitTest.java +++ b/src/test/java/run/halo/app/utils/GitTest.java @@ -4,6 +4,7 @@ import org.eclipse.jgit.api.Git; import org.eclipse.jgit.api.Status; import org.eclipse.jgit.api.errors.GitAPIException; import org.eclipse.jgit.errors.RepositoryNotFoundException; +import org.junit.Ignore; import org.junit.Test; import java.io.IOException; @@ -16,6 +17,7 @@ import java.nio.file.Path; * @author johnniang * @date 19-5-21 */ +@Ignore public class GitTest { private final Path tempPath; diff --git a/src/test/java/run/halo/app/utils/GithubTest.java b/src/test/java/run/halo/app/utils/GithubTest.java index 4305ac26a..cdb33cab4 100644 --- a/src/test/java/run/halo/app/utils/GithubTest.java +++ b/src/test/java/run/halo/app/utils/GithubTest.java @@ -1,6 +1,7 @@ package run.halo.app.utils; import org.junit.Assert; +import org.junit.Ignore; import org.junit.Test; import org.springframework.http.ResponseEntity; import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; @@ -23,6 +24,7 @@ import java.util.Map; * @author johnniang * @date 19-5-21 */ +@Ignore public class GithubTest { private final Path tempPath; From f78d6d4c3f2dc3d873e71bba1baa2b2c288d464e Mon Sep 17 00:00:00 2001 From: ruibaby Date: Thu, 23 May 2019 00:28:58 +0800 Subject: [PATCH 4/5] Fixed: The problem that the new comment notification message is empty. --- .../run/halo/app/event/comment/CommentEventListener.java | 6 +++--- .../java/run/halo/app/service/impl/AdminServiceImpl.java | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/run/halo/app/event/comment/CommentEventListener.java b/src/main/java/run/halo/app/event/comment/CommentEventListener.java index f7d0a73a5..8afddcb2c 100644 --- a/src/main/java/run/halo/app/event/comment/CommentEventListener.java +++ b/src/main/java/run/halo/app/event/comment/CommentEventListener.java @@ -70,7 +70,7 @@ public class CommentEventListener { Map data = new HashMap<>(); - if (newEvent.getSource() instanceof PostService) { + if (newEvent.getSource() instanceof PostCommentService) { // Get postComment id PostComment postComment = postCommentService.getById(newEvent.getCommentId()); @@ -85,7 +85,7 @@ public class CommentEventListener { data.put("page", post.getTitle()); data.put("author", postComment.getAuthor()); data.put("content", postComment.getContent()); - } else if (newEvent.getSource() instanceof SheetService) { + } else if (newEvent.getSource() instanceof SheetCommentService) { SheetComment sheetComment = sheetCommentService.getById(newEvent.getCommentId()); log.debug("Got sheet comment: [{}]", sheetComment); @@ -99,7 +99,7 @@ public class CommentEventListener { data.put("page", sheet.getTitle()); data.put("author", sheetComment.getAuthor()); data.put("content", sheetComment.getContent()); - } else if (newEvent.getSource() instanceof JournalService) { + } else if (newEvent.getSource() instanceof JournalCommentService) { JournalComment journalComment = journalCommentService.getById(newEvent.getCommentId()); log.debug("Got journal comment: [{}]", journalComment); diff --git a/src/main/java/run/halo/app/service/impl/AdminServiceImpl.java b/src/main/java/run/halo/app/service/impl/AdminServiceImpl.java index 73259a8f5..6b8ffca48 100644 --- a/src/main/java/run/halo/app/service/impl/AdminServiceImpl.java +++ b/src/main/java/run/halo/app/service/impl/AdminServiceImpl.java @@ -192,7 +192,7 @@ public class AdminServiceImpl implements AdminService { Assert.hasText(refreshToken, "Refresh token must not be blank"); Integer userId = cacheStore.getAny(SecurityUtils.buildTokenRefreshKey(refreshToken), Integer.class) - .orElseThrow(() -> new BadRequestException("The refresh token may have been expired already").setErrorData(refreshToken)); + .orElseThrow(() -> new BadRequestException("登陆状态已失效,请重新登陆").setErrorData(refreshToken)); // Get user info User user = userService.getById(userId); From b091f52711bfa3226cd971079922b6876972ad01 Mon Sep 17 00:00:00 2001 From: ruibaby Date: Thu, 23 May 2019 00:36:46 +0800 Subject: [PATCH 5/5] Fixed: Format the commenter's website url. --- .../halo/app/service/impl/BaseCommentServiceImpl.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/run/halo/app/service/impl/BaseCommentServiceImpl.java b/src/main/java/run/halo/app/service/impl/BaseCommentServiceImpl.java index 479d542c6..906cac579 100644 --- a/src/main/java/run/halo/app/service/impl/BaseCommentServiceImpl.java +++ b/src/main/java/run/halo/app/service/impl/BaseCommentServiceImpl.java @@ -1,5 +1,6 @@ package run.halo.app.service.impl; +import cn.hutool.core.util.URLUtil; import lombok.extern.slf4j.Slf4j; import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.lang3.StringUtils; @@ -55,13 +56,10 @@ import java.util.stream.Collectors; @Slf4j public abstract class BaseCommentServiceImpl extends AbstractCrudService implements BaseCommentService { - private final BaseCommentRepository baseCommentRepository; - protected final OptionService optionService; - protected final UserService userService; - protected final ApplicationEventPublisher eventPublisher; + private final BaseCommentRepository baseCommentRepository; public BaseCommentServiceImpl(BaseCommentRepository baseCommentRepository, OptionService optionService, @@ -247,6 +245,10 @@ public abstract class BaseCommentServiceImpl extend comment.setGavatarMd5(DigestUtils.md5Hex(comment.getEmail())); } + if (StringUtils.isNotEmpty(comment.getAuthorUrl())) { + comment.setAuthorUrl(URLUtil.normalize(comment.getAuthorUrl())); + } + if (authentication != null) { // Comment of blogger comment.setIsAdmin(true);