rendering comments html in profile comments and replies tabs

This commit is contained in:
Nouman Tahir 2021-09-20 19:53:06 +05:00
parent a85227d834
commit dea9a6c80e
2 changed files with 7 additions and 7 deletions

View File

@ -522,7 +522,7 @@ export const getRankedPosts = async (query, currentUserName, filterNsfw) => {
if (posts) {
const areComments = query.sort === 'comments' || query.sort === 'replies';
posts = parsePosts(posts, currentUserName, areComments);
posts = areComments ? parseComments(posts) : parsePosts(posts, currentUserName);
if (filterNsfw !== '0') {
const updatedPosts = filterNsfwPost(posts, filterNsfw);
@ -543,7 +543,7 @@ export const getAccountPosts = async (query, currentUserName, filterNsfw) => {
if (posts) {
const areComments = query.sort === 'comments' || query.sort === 'replies';
posts = parsePosts(posts, currentUserName, areComments);
posts = areComments ? parseComments(posts) : parsePosts(posts, currentUserName);
if (filterNsfw !== '0') {
const updatedPosts = filterNsfwPost(posts, filterNsfw);

View File

@ -12,17 +12,17 @@ import { parseReputation } from './user';
const webp = Platform.OS === 'ios' ? false : true;
export const parsePosts = (posts, currentUserName, areComments) => {
export const parsePosts = (posts, currentUserName) => {
if (posts) {
const formattedPosts = posts.map((post) =>
parsePost(post, currentUserName, false, true, areComments),
parsePost(post, currentUserName, false, true),
);
return formattedPosts;
}
return null;
};
export const parsePost = (post, currentUserName, isPromoted, isList = false, isComment = false) => {
export const parsePost = (post, currentUserName, isPromoted, isList = false) => {
if (!post) {
return null;
}
@ -62,7 +62,7 @@ export const parsePost = (post, currentUserName, isPromoted, isList = false, isC
post.post_fetched_at = new Date().getTime();
//discard post body if list
if (isList && !isComment) {
if (isList) {
post.body = '';
}
@ -120,7 +120,7 @@ export const parseCommentThreads = async (commentsMap:any, author:string, permli
export const parseComments = async (comments:any[]) => {
export const parseComments = (comments:any[]) => {
if(!comments){
return null;
}