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
91a55753
Unverified
Commit
91a55753
authored
Jun 01, 2019
by
Liang Ding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🎨
#12787 升级程序
parent
02edff31
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
6 deletions
+17
-6
src/main/java/org/b3log/solo/upgrade/V361_362.java
src/main/java/org/b3log/solo/upgrade/V361_362.java
+17
-6
No files found.
src/main/java/org/b3log/solo/upgrade/V361_362.java
View file @
91a55753
...
...
@@ -75,19 +75,30 @@ public final class V361_362 {
// 迁移历史表情图片 https://github.com/b3log/solo/issues/12787
final
List
<
JSONObject
>
articles
=
articleRepository
.
getList
(
new
Query
());
for
(
final
JSONObject
article
:
articles
)
{
String
articleContent
=
article
.
optString
(
Article
.
ARTICLE_CONTENT
);
final
String
oldContent
=
article
.
optString
(
Article
.
ARTICLE_CONTENT
);
String
articleContent
=
oldContent
;
articleContent
=
Emotions
.
convert
(
articleContent
);
articleContent
=
convertEm00
(
articleContent
);
article
.
put
(
Article
.
ARTICLE_CONTENT
,
articleContent
);
articleRepository
.
update
(
article
.
optString
(
Keys
.
OBJECT_ID
),
article
);
if
(!
StringUtils
.
equalsIgnoreCase
(
oldContent
,
articleContent
))
{
article
.
put
(
Article
.
ARTICLE_CONTENT
,
articleContent
);
final
String
articleId
=
article
.
optString
(
Keys
.
OBJECT_ID
);
articleRepository
.
update
(
articleId
,
article
);
LOGGER
.
log
(
Level
.
INFO
,
"Migrated article [id="
+
articleId
+
"]'s content emoji"
);
}
}
final
List
<
JSONObject
>
comments
=
commentRepository
.
getList
(
new
Query
());
for
(
final
JSONObject
comment
:
comments
)
{
String
commentContent
=
comment
.
optString
(
Comment
.
COMMENT_CONTENT
);
final
String
oldContent
=
comment
.
optString
(
Comment
.
COMMENT_CONTENT
);
String
commentContent
=
oldContent
;
commentContent
=
Emotions
.
convert
(
commentContent
);
commentContent
=
convertEm00
(
commentContent
);
comment
.
put
(
Comment
.
COMMENT_CONTENT
,
commentContent
);
commentRepository
.
update
(
comment
.
optString
(
Keys
.
OBJECT_ID
),
comment
);
if
(!
StringUtils
.
equalsIgnoreCase
(
oldContent
,
commentContent
))
{
comment
.
put
(
Comment
.
COMMENT_CONTENT
,
commentContent
);
final
String
commentId
=
comment
.
optString
(
Keys
.
OBJECT_ID
);
comment
.
put
(
Comment
.
COMMENT_CONTENT
,
commentContent
);
commentRepository
.
update
(
commentId
,
comment
);
LOGGER
.
log
(
Level
.
INFO
,
"Migrated comment [id="
+
commentId
+
"]'s content emoji"
);
}
}
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