fix: bug fix for comment data fetcher

This commit is contained in:
xushanchuan 2021-03-19 15:52:13 +08:00
parent 44a70270c8
commit 7478515067
No known key found for this signature in database
GPG Key ID: 44D23C44E00838D6

View File

@ -17,10 +17,12 @@ import io.spring.application.data.CommentData;
import io.spring.core.user.User;
import io.spring.graphql.DgsConstants.ARTICLE;
import io.spring.graphql.DgsConstants.COMMENTPAYLOAD;
import io.spring.graphql.types.Article;
import io.spring.graphql.types.Comment;
import io.spring.graphql.types.CommentEdge;
import io.spring.graphql.types.CommentsConnection;
import java.util.HashMap;
import java.util.Map;
import java.util.stream.Collectors;
import org.joda.time.format.ISODateTimeFormat;
import org.springframework.beans.factory.annotation.Autowired;
@ -62,7 +64,9 @@ public class CommentDatafetcher {
}
User current = SecurityUtil.getCurrentUser().orElse(null);
ArticleData articleData = dfe.getLocalContext();
Article article = dfe.getSource();
Map<String, ArticleData> map = dfe.getLocalContext();
ArticleData articleData = map.get(article.getSlug());
CursorPager<CommentData> comments;
if (first != null) {