Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
solo-1
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
solo-1
Commits
b3483274
Unverified
Commit
b3483274
authored
Jun 13, 2019
by
Liang Ding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🔥
移除 v3.5.0 过渡升级用的兼容代码
parent
20184a9e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
53 deletions
+10
-53
src/main/java/org/b3log/solo/processor/console/PreferenceConsole.java
...a/org/b3log/solo/processor/console/PreferenceConsole.java
+1
-8
src/main/java/org/b3log/solo/service/OptionQueryService.java
src/main/java/org/b3log/solo/service/OptionQueryService.java
+2
-10
src/main/java/org/b3log/solo/service/PreferenceMgmtService.java
...in/java/org/b3log/solo/service/PreferenceMgmtService.java
+4
-14
src/main/java/org/b3log/solo/service/SkinMgmtService.java
src/main/java/org/b3log/solo/service/SkinMgmtService.java
+3
-21
No files found.
src/main/java/org/b3log/solo/processor/console/PreferenceConsole.java
View file @
b3483274
...
...
@@ -17,7 +17,6 @@
*/
package
org
.
b3log
.
solo
.
processor
.
console
;
import
org.apache.commons.lang.StringUtils
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.ioc.Inject
;
import
org.b3log.latke.logging.Level
;
...
...
@@ -41,7 +40,7 @@ import org.json.JSONObject;
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author <a href="https://github.com/hzchendou">hzchendou</a>
* @version 1.2.0.2
4, Mar 29
, 2019
* @version 1.2.0.2
5, Jun 13
, 2019
* @since 0.4.0
*/
@RequestProcessor
...
...
@@ -184,12 +183,6 @@ public class PreferenceConsole {
return
;
}
String
hljsTheme
=
preference
.
optString
(
Option
.
ID_C_HLJS_THEME
);
if
(
StringUtils
.
isBlank
(
hljsTheme
))
{
// TODO: 在 v3.5.0 发布后可移除判空
hljsTheme
=
Option
.
DefaultPreference
.
DEFAULT_HLJS_THEME
;
preference
.
put
(
Option
.
ID_C_HLJS_THEME
,
hljsTheme
);
}
String
footerContent
=
""
;
final
JSONObject
opt
=
optionQueryService
.
getOptionById
(
Option
.
ID_C_FOOTER_CONTENT
);
if
(
null
!=
opt
)
{
...
...
src/main/java/org/b3log/solo/service/OptionQueryService.java
View file @
b3483274
...
...
@@ -30,7 +30,7 @@ import org.json.JSONObject;
* Option query service.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.0.
3, Dec 3, 2018
* @version 1.0.0.
4, Jun 13, 2019
* @since 0.6.0
*/
@Service
...
...
@@ -54,15 +54,7 @@ public class OptionQueryService {
*/
public
JSONObject
getSkin
()
{
try
{
JSONObject
ret
=
getOptions
(
Option
.
CATEGORY_C_SKIN
);
if
(
null
==
ret
)
{
// TODO: 在 v3.5.0 发布后可移除判空
ret
=
new
JSONObject
().
put
(
Option
.
ID_C_SKIN_DIR_NAME
,
Option
.
DefaultPreference
.
DEFAULT_SKIN_DIR_NAME
).
put
(
Option
.
ID_C_MOBILE_SKIN_DIR_NAME
,
Option
.
DefaultPreference
.
DEFAULT_MOBILE_SKIN_DIR_NAME
);
}
return
ret
;
return
getOptions
(
Option
.
CATEGORY_C_SKIN
);
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
ERROR
,
"Gets skin failed"
,
e
);
...
...
src/main/java/org/b3log/solo/service/PreferenceMgmtService.java
View file @
b3483274
...
...
@@ -17,7 +17,6 @@
*/
package
org
.
b3log
.
solo
.
service
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.Latkes
;
import
org.b3log.latke.ioc.Inject
;
import
org.b3log.latke.logging.Level
;
...
...
@@ -38,7 +37,7 @@ import java.util.Locale;
* Preference management service.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.4.0.
0, Mar 29
, 2019
* @version 1.4.0.
1, Jun 13
, 2019
* @since 0.4.0
*/
@Service
...
...
@@ -211,18 +210,9 @@ public class PreferenceMgmtService {
syncGitHubOpt
.
put
(
Option
.
OPTION_VALUE
,
preference
.
optString
(
Option
.
ID_C_SYNC_GITHUB
));
optionRepository
.
update
(
Option
.
ID_C_SYNC_GITHUB
,
syncGitHubOpt
);
// TODO: 在 v3.5.0 发布后可移除判空
JSONObject
hljsThemeOpt
=
optionRepository
.
get
(
Option
.
ID_C_HLJS_THEME
);
if
(
null
==
hljsThemeOpt
)
{
hljsThemeOpt
=
new
JSONObject
();
hljsThemeOpt
.
put
(
Keys
.
OBJECT_ID
,
Option
.
ID_C_HLJS_THEME
);
hljsThemeOpt
.
put
(
Option
.
OPTION_CATEGORY
,
Option
.
CATEGORY_C_PREFERENCE
);
hljsThemeOpt
.
put
(
Option
.
OPTION_VALUE
,
Option
.
DefaultPreference
.
DEFAULT_HLJS_THEME
);
optionRepository
.
add
(
hljsThemeOpt
);
}
else
{
hljsThemeOpt
.
put
(
Option
.
OPTION_VALUE
,
preference
.
optString
(
Option
.
ID_C_HLJS_THEME
));
optionRepository
.
update
(
Option
.
ID_C_HLJS_THEME
,
hljsThemeOpt
);
}
final
JSONObject
hljsThemeOpt
=
optionRepository
.
get
(
Option
.
ID_C_HLJS_THEME
);
hljsThemeOpt
.
put
(
Option
.
OPTION_VALUE
,
preference
.
optString
(
Option
.
ID_C_HLJS_THEME
));
optionRepository
.
update
(
Option
.
ID_C_HLJS_THEME
,
hljsThemeOpt
);
final
JSONObject
customVarsOpt
=
optionRepository
.
get
(
Option
.
ID_C_CUSTOM_VARS
);
customVarsOpt
.
put
(
Option
.
OPTION_VALUE
,
preference
.
optString
(
Option
.
ID_C_CUSTOM_VARS
));
...
...
src/main/java/org/b3log/solo/service/SkinMgmtService.java
View file @
b3483274
...
...
@@ -17,7 +17,6 @@
*/
package
org
.
b3log
.
solo
.
service
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.ioc.Inject
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
...
...
@@ -36,7 +35,7 @@ import java.util.Set;
* Skin management service.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.0.
0, Mar 29
, 2019
* @version 1.0.0.
1, Jun 13
, 2019
* @since 3.5.0
*/
@Service
...
...
@@ -97,29 +96,12 @@ public class SkinMgmtService {
public
void
updateSkin
(
final
JSONObject
skin
)
throws
ServiceException
{
final
Transaction
transaction
=
optionRepository
.
beginTransaction
();
try
{
JSONObject
skinDirNameOpt
=
optionRepository
.
get
(
Option
.
ID_C_SKIN_DIR_NAME
);
if
(
null
==
skinDirNameOpt
)
{
skinDirNameOpt
=
new
JSONObject
();
skinDirNameOpt
.
put
(
Keys
.
OBJECT_ID
,
Option
.
ID_C_SKIN_DIR_NAME
);
skinDirNameOpt
.
put
(
Option
.
OPTION_CATEGORY
,
Option
.
CATEGORY_C_SKIN
);
skinDirNameOpt
.
put
(
Option
.
OPTION_VALUE
,
Option
.
DefaultPreference
.
DEFAULT_SKIN_DIR_NAME
);
optionRepository
.
add
(
skinDirNameOpt
);
}
final
JSONObject
skinDirNameOpt
=
optionRepository
.
get
(
Option
.
ID_C_SKIN_DIR_NAME
);
skinDirNameOpt
.
put
(
Option
.
OPTION_VALUE
,
skin
.
optString
(
Option
.
ID_C_SKIN_DIR_NAME
));
skinDirNameOpt
.
put
(
Option
.
OPTION_CATEGORY
,
Option
.
CATEGORY_C_SKIN
);
// TODO: 在 v3.5.0 发布后可移除
optionRepository
.
update
(
Option
.
ID_C_SKIN_DIR_NAME
,
skinDirNameOpt
);
JSONObject
mobileSkinDirNameOpt
=
optionRepository
.
get
(
Option
.
ID_C_MOBILE_SKIN_DIR_NAME
);
// TODO: 在 v3.5.0 发布后可移除判空
if
(
null
==
mobileSkinDirNameOpt
)
{
mobileSkinDirNameOpt
=
new
JSONObject
();
mobileSkinDirNameOpt
.
put
(
Keys
.
OBJECT_ID
,
Option
.
ID_C_MOBILE_SKIN_DIR_NAME
);
mobileSkinDirNameOpt
.
put
(
Option
.
OPTION_CATEGORY
,
Option
.
CATEGORY_C_SKIN
);
mobileSkinDirNameOpt
.
put
(
Option
.
OPTION_VALUE
,
Option
.
DefaultPreference
.
DEFAULT_MOBILE_SKIN_DIR_NAME
);
optionRepository
.
add
(
mobileSkinDirNameOpt
);
}
final
JSONObject
mobileSkinDirNameOpt
=
optionRepository
.
get
(
Option
.
ID_C_MOBILE_SKIN_DIR_NAME
);
mobileSkinDirNameOpt
.
put
(
Option
.
OPTION_VALUE
,
skin
.
optString
(
Option
.
ID_C_MOBILE_SKIN_DIR_NAME
));
mobileSkinDirNameOpt
.
put
(
Option
.
OPTION_CATEGORY
,
Option
.
CATEGORY_C_SKIN
);
// TODO: 在 v3.5.0 发布后可移除
optionRepository
.
update
(
Option
.
ID_C_MOBILE_SKIN_DIR_NAME
,
mobileSkinDirNameOpt
);
transaction
.
commit
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment