Commit b52e020b authored by Liang Ding's avatar Liang Ding

🐛 修复评论人头像不显示问题

https://hacpai.com/article/1497494920030
parent a7d76399
......@@ -50,7 +50,7 @@ import java.util.List;
* Comment query service.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.3.0.9, Feb 18, 2017
* @version 1.3.1.9, Jun 15, 2017
* @since 0.3.5
*/
@Service
......@@ -59,7 +59,7 @@ public class CommentQueryService {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(CommentQueryService.class.getName());
private static final Logger LOGGER = Logger.getLogger(CommentQueryService.class);
/**
* User service.
......@@ -89,7 +89,7 @@ public class CommentQueryService {
* Can the current user access a comment specified by the given comment id?
*
* @param commentId the given comment id
* @param request the specified request
* @param request the specified request
* @return {@code true} if the current user can access the comment, {@code false} otherwise
* @throws Exception exception
*/
......@@ -104,7 +104,6 @@ public class CommentQueryService {
// Here, you are not admin
final JSONObject comment = commentRepository.get(commentId);
if (null == comment) {
return false;
}
......@@ -117,7 +116,6 @@ public class CommentQueryService {
}
final JSONObject article = articleRepository.get(onId);
if (null == article) {
return false;
}
......@@ -130,15 +128,12 @@ public class CommentQueryService {
/**
* Gets comments with the specified request json object, request and response.
*
* @param requestJSONObject the specified request json object, for example, <pre>
* {
* "paginationCurrentPageNum": 1,
* "paginationPageSize": 20,
* "paginationWindowSize": 10
* }, see {@link Pagination} for more details
* </pre>
*
* @return for example, <pre>
* @param requestJSONObject the specified request json object, for example,
* "paginationCurrentPageNum": 1,
* "paginationPageSize": 20,
* "paginationWindowSize": 10
* @return for example,
* <pre>
* {
* "comments": [{
* "oId": "",
......@@ -154,7 +149,6 @@ public class CommentQueryService {
* "sc": "GET_COMMENTS_SUCC"
* }
* </pre>
*
* @throws ServiceException service exception
* @see Pagination
*/
......@@ -246,7 +240,10 @@ public class CommentQueryService {
final String email = comment.optString(Comment.COMMENT_EMAIL);
comment.put(Comment.COMMENT_THUMBNAIL_URL, Thumbnails.getGravatarURL(email, "128"));
final String thumbnailURL = comment.optString(Comment.COMMENT_THUMBNAIL_URL);
if (Strings.isEmptyOrNull(thumbnailURL)) {
comment.put(Comment.COMMENT_THUMBNAIL_URL, Thumbnails.getGravatarURL(email, "128"));
}
if (!Strings.isEmptyOrNull(comment.optString(Comment.COMMENT_ORIGINAL_COMMENT_ID))) {
// This comment is a reply
......
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