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
2014b500
Commit
2014b500
authored
Jun 16, 2017
by
Liang Ding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🐛
动态页 emoji 渲染
parent
8503f1cd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
10 deletions
+17
-10
src/main/java/org/b3log/solo/processor/util/Filler.java
src/main/java/org/b3log/solo/processor/util/Filler.java
+17
-10
No files found.
src/main/java/org/b3log/solo/processor/util/Filler.java
View file @
2014b500
...
@@ -41,6 +41,8 @@ import org.b3log.solo.SoloServletListener;
...
@@ -41,6 +41,8 @@ import org.b3log.solo.SoloServletListener;
import
org.b3log.solo.model.*
;
import
org.b3log.solo.model.*
;
import
org.b3log.solo.repository.*
;
import
org.b3log.solo.repository.*
;
import
org.b3log.solo.service.*
;
import
org.b3log.solo.service.*
;
import
org.b3log.solo.util.Emotions
;
import
org.b3log.solo.util.Markdowns
;
import
org.b3log.solo.util.Thumbnails
;
import
org.b3log.solo.util.Thumbnails
;
import
org.b3log.solo.util.comparator.Comparators
;
import
org.b3log.solo.util.comparator.Comparators
;
import
org.json.JSONArray
;
import
org.json.JSONArray
;
...
@@ -58,7 +60,7 @@ import static org.b3log.solo.model.Article.ARTICLE_CONTENT;
...
@@ -58,7 +60,7 @@ import static org.b3log.solo.model.Article.ARTICLE_CONTENT;
*
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @version 1.6.1
3.13, May 21
, 2017
* @version 1.6.1
4.13, Jun 16
, 2017
* @since 0.3.1
* @since 0.3.1
*/
*/
@Service
@Service
...
@@ -545,21 +547,28 @@ public class Filler {
...
@@ -545,21 +547,28 @@ public class Filler {
final
List
<
JSONObject
>
recentComments
=
commentRepository
.
getRecentComments
(
recentCommentDisplayCnt
);
final
List
<
JSONObject
>
recentComments
=
commentRepository
.
getRecentComments
(
recentCommentDisplayCnt
);
for
(
final
JSONObject
comment
:
recentComments
)
{
for
(
final
JSONObject
comment
:
recentComments
)
{
final
String
content
=
comment
.
getString
(
Comment
.
COMMENT_CONTENT
);
String
commentContent
=
comment
.
optString
(
Comment
.
COMMENT_CONTENT
);
comment
.
put
(
Comment
.
COMMENT_CONTENT
,
content
);
commentContent
=
Emotions
.
convert
(
commentContent
);
commentContent
=
Markdowns
.
toHTML
(
commentContent
);
comment
.
put
(
Comment
.
COMMENT_CONTENT
,
commentContent
);
comment
.
put
(
Comment
.
COMMENT_NAME
,
comment
.
getString
(
Comment
.
COMMENT_NAME
));
comment
.
put
(
Comment
.
COMMENT_NAME
,
comment
.
getString
(
Comment
.
COMMENT_NAME
));
comment
.
put
(
Comment
.
COMMENT_URL
,
comment
.
getString
(
Comment
.
COMMENT_URL
));
comment
.
put
(
Comment
.
COMMENT_URL
,
comment
.
getString
(
Comment
.
COMMENT_URL
));
comment
.
remove
(
Comment
.
COMMENT_EMAIL
);
// Erases email for security reason
comment
.
remove
(
Comment
.
COMMENT_EMAIL
);
// Erases email for security reason
final
String
email
=
comment
.
optString
(
Comment
.
COMMENT_EMAIL
);
final
String
thumbnailURL
=
comment
.
optString
(
Comment
.
COMMENT_THUMBNAIL_URL
);
if
(
Strings
.
isEmptyOrNull
(
thumbnailURL
))
{
comment
.
put
(
Comment
.
COMMENT_THUMBNAIL_URL
,
Thumbnails
.
getGravatarURL
(
email
,
"128"
));
}
}
}
dataModel
.
put
(
Common
.
RECENT_COMMENTS
,
recentComments
);
dataModel
.
put
(
Common
.
RECENT_COMMENTS
,
recentComments
);
}
catch
(
final
JSONException
e
)
{
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
ERROR
,
"Fills recent comments failed"
,
e
);
throw
new
ServiceException
(
e
);
}
catch
(
final
RepositoryException
e
)
{
LOGGER
.
log
(
Level
.
ERROR
,
"Fills recent comments failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Fills recent comments failed"
,
e
);
throw
new
ServiceException
(
e
);
throw
new
ServiceException
(
e
);
}
finally
{
}
finally
{
Stopwatchs
.
end
();
Stopwatchs
.
end
();
...
@@ -960,7 +969,6 @@ public class Filler {
...
@@ -960,7 +969,6 @@ public class Filler {
* Sets some extra properties into the specified article with the specified preference, performs content and
* Sets some extra properties into the specified article with the specified preference, performs content and
* abstract editor processing.
* abstract editor processing.
* <p>
* <p>
* <p>
* Article ext properties:
* Article ext properties:
* <pre>
* <pre>
* {
* {
...
@@ -978,8 +986,7 @@ public class Filler {
...
@@ -978,8 +986,7 @@ public class Filler {
* @throws ServiceException service exception
* @throws ServiceException service exception
* @see #setArticlesExProperties(HttpServletRequest, List, JSONObject)
* @see #setArticlesExProperties(HttpServletRequest, List, JSONObject)
*/
*/
private
void
setArticleExProperties
(
final
HttpServletRequest
request
,
private
void
setArticleExProperties
(
final
HttpServletRequest
request
,
final
JSONObject
article
,
final
JSONObject
preference
)
throws
ServiceException
{
final
JSONObject
article
,
final
JSONObject
preference
)
throws
ServiceException
{
try
{
try
{
final
JSONObject
author
=
articleQueryService
.
getAuthor
(
article
);
final
JSONObject
author
=
articleQueryService
.
getAuthor
(
article
);
final
String
authorName
=
author
.
getString
(
User
.
USER_NAME
);
final
String
authorName
=
author
.
getString
(
User
.
USER_NAME
);
...
...
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