Commit 35518019 authored by Van's avatar Van

Merge remote-tracking branch 'origin/3.4.0-dev' into 3.4.0-dev

parents 1eafe240 d7536e2d
...@@ -95,8 +95,8 @@ docker pull b3log/solo ...@@ -95,8 +95,8 @@ docker pull b3log/solo
``` ```
* 使用 MySQL * 使用 MySQL
先手动建库(字符集使用 `utf8mb4`,排序规则 `utf8mb4_general_ci`),然后启动容器:
先手动建库(字符集使用 `utf8mb4`,排序规则 `utf8mb4_general_ci`),然后启动容器:
```shell ```shell
docker run --detach --name solo --network=host \ docker run --detach --name solo --network=host \
--env RUNTIME_DB="MYSQL" \ --env RUNTIME_DB="MYSQL" \
......
...@@ -406,6 +406,7 @@ public final class SoloServletListener extends AbstractServletListener { ...@@ -406,6 +406,7 @@ public final class SoloServletListener extends AbstractServletListener {
final OtherConsole otherConsole = beanManager.getReference(OtherConsole.class); final OtherConsole otherConsole = beanManager.getReference(OtherConsole.class);
DispatcherServlet.delete("/console/archive/unused", otherConsole::removeUnusedArchives); DispatcherServlet.delete("/console/archive/unused", otherConsole::removeUnusedArchives);
DispatcherServlet.delete("/console/tag/unused", otherConsole::removeUnusedTags);
final UserConsole userConsole = beanManager.getReference(UserConsole.class); final UserConsole userConsole = beanManager.getReference(UserConsole.class);
DispatcherServlet.put("/console/user/", userConsole::updateUser); DispatcherServlet.put("/console/user/", userConsole::updateUser);
......
...@@ -27,7 +27,6 @@ import org.b3log.latke.logging.Logger; ...@@ -27,7 +27,6 @@ import org.b3log.latke.logging.Logger;
import org.b3log.latke.model.Role; import org.b3log.latke.model.Role;
import org.b3log.latke.model.User; import org.b3log.latke.model.User;
import org.b3log.latke.plugin.PluginManager; import org.b3log.latke.plugin.PluginManager;
import org.b3log.latke.repository.Query;
import org.b3log.latke.repository.RepositoryException; import org.b3log.latke.repository.RepositoryException;
import org.b3log.latke.repository.Transaction; import org.b3log.latke.repository.Transaction;
import org.b3log.latke.repository.jdbc.util.Connections; import org.b3log.latke.repository.jdbc.util.Connections;
...@@ -56,7 +55,7 @@ import java.util.Set; ...@@ -56,7 +55,7 @@ import java.util.Set;
* Solo initialization service. * Solo initialization service.
* *
* @author <a href="http://88250.b3log.org">Liang Ding</a> * @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.5.2.30, Mar 2, 2019 * @version 1.5.2.31, Mar 23, 2019
* @since 0.4.0 * @since 0.4.0
*/ */
@Service @Service
...@@ -160,7 +159,7 @@ public class InitService { ...@@ -160,7 +159,7 @@ public class InitService {
} }
try { try {
inited = !optionRepository.getList(new Query()).isEmpty(); inited = null != optionRepository.get(Option.ID_C_VERSION);
if (!inited && !printedInitMsg) { if (!inited && !printedInitMsg) {
LOGGER.log(Level.WARN, "Solo has not been initialized, please open your browser to init Solo"); LOGGER.log(Level.WARN, "Solo has not been initialized, please open your browser to init Solo");
printedInitMsg = true; printedInitMsg = true;
......
...@@ -132,6 +132,10 @@ public class PageMgmtService { ...@@ -132,6 +132,10 @@ public class PageMgmtService {
return; return;
} }
if (null == admin) {
return;
}
final String githubId = admin.optString(UserExt.USER_GITHUB_ID); final String githubId = admin.optString(UserExt.USER_GITHUB_ID);
final JSONArray gitHubRepos = GitHubs.getGitHubRepos(githubId); final JSONArray gitHubRepos = GitHubs.getGitHubRepos(githubId);
if (null == gitHubRepos || gitHubRepos.isEmpty()) { if (null == gitHubRepos || gitHubRepos.isEmpty()) {
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
<html> <html>
<head> <head>
<#if !blogTitle??> <#if !blogTitle??>
<#assign blogTitle = welcomeToSoloLabel> <#assign blogTitle = "Solo">
</#if> </#if>
<@head title="${title} - ${blogTitle}"> <@head title="${title} - ${blogTitle}">
<link type="text/css" rel="stylesheet" <link type="text/css" rel="stylesheet"
......
...@@ -145,7 +145,7 @@ public class MockHttpServletRequest implements HttpServletRequest { ...@@ -145,7 +145,7 @@ public class MockHttpServletRequest implements HttpServletRequest {
@Override @Override
public String getQueryString() { public String getQueryString() {
throw new UnsupportedOperationException("Not supported yet."); return "";
} }
@Override @Override
......
...@@ -49,7 +49,7 @@ public class IndexProcessorTestCase extends AbstractTestCase { ...@@ -49,7 +49,7 @@ public class IndexProcessorTestCase extends AbstractTestCase {
mockDispatcherServletService(request, response); mockDispatcherServletService(request, response);
final String content = response.body(); final String content = response.body();
Assert.assertTrue(StringUtils.contains(content, "<title>欢迎使用!</title>")); Assert.assertTrue(StringUtils.contains(content, "<title>欢迎使用! - Solo</title>"));
} }
/** /**
......
...@@ -58,6 +58,6 @@ public class TagProcessorTestCase extends AbstractTestCase { ...@@ -58,6 +58,6 @@ public class TagProcessorTestCase extends AbstractTestCase {
mockDispatcherServletService(request, response); mockDispatcherServletService(request, response);
final String content = response.body(); final String content = response.body();
Assert.assertTrue(StringUtils.contains(content, "<title>Solo - Solo 的个人博客</title>")); Assert.assertTrue(StringUtils.contains(content, "<title>Solo 标签 - Solo 的个人博客</title>"));
} }
} }
package org.b3log.solo.processor.console;
import org.apache.commons.lang.StringUtils;
import org.b3log.solo.AbstractTestCase;
import org.b3log.solo.MockHttpServletRequest;
import org.b3log.solo.MockHttpServletResponse;
import org.testng.Assert;
import org.testng.annotations.Test;
/**
* {@link OtherConsole} test case.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.0.0, Mar 23, 2019
* @since 3.4.0
*/
@Test(suiteName = "processor")
public class OtherConsoleTestCase extends AbstractTestCase {
/**
* Init.
*
* @throws Exception exception
*/
@Test
public void init() throws Exception {
super.init();
}
/**
* removeUnusedArchives.
*
* @throws Exception exception
*/
@Test(dependsOnMethods = "init")
public void removeUnusedArchives() throws Exception {
final MockHttpServletRequest request = mockRequest();
request.setRequestURI("/console/archive/unused");
request.setMethod("DELETE");
mockAdminLogin(request);
final MockHttpServletResponse response = mockResponse();
mockDispatcherServletService(request, response);
final String content = response.body();
Assert.assertTrue(StringUtils.contains(content, "sc\":true"));
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment