From 7222075bf7e3063dd00a39128725b822eccae111 Mon Sep 17 00:00:00 2001 From: Nouman Tahir Date: Tue, 23 Mar 2021 11:41:03 +0500 Subject: [PATCH] skipping body removal for comments list --- src/providers/hive/dhive.js | 10 ++++------ src/utils/postParser.js | 10 ++++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/providers/hive/dhive.js b/src/providers/hive/dhive.js index 1f0e9cd25..67748e42c 100644 --- a/src/providers/hive/dhive.js +++ b/src/providers/hive/dhive.js @@ -462,9 +462,8 @@ export const getRankedPosts = async (query, currentUserName, filterNsfw) => { let posts = await client.call('bridge', 'get_ranked_posts', query); if (posts) { - posts = parsePosts(posts, currentUserName); - - // FastImage.preload(posts.map(post=>({uri:post.image}))) + const areComments = query.sort === 'comments'; + posts = parsePosts(posts, currentUserName, areComments); if (filterNsfw !== '0') { const updatedPosts = filterNsfwPost(posts, filterNsfw); @@ -484,9 +483,8 @@ export const getAccountPosts = async (query, currentUserName, filterNsfw) => { let posts = await client.call('bridge', 'get_account_posts', query); if (posts) { - posts = parsePosts(posts, currentUserName); - - // FastImage.preload(posts.map(post=>({uri:post.image}))) + const areComments = query.sort === 'comments'; + posts = parsePosts(posts, currentUserName, areComments); if (filterNsfw !== '0') { const updatedPosts = filterNsfwPost(posts, filterNsfw); diff --git a/src/utils/postParser.js b/src/utils/postParser.js index 45fb108d5..ab8467cd3 100644 --- a/src/utils/postParser.js +++ b/src/utils/postParser.js @@ -12,15 +12,17 @@ import { getResizedAvatar, getResizedImage } from './image'; const webp = Platform.OS === 'ios' ? false : true; -export const parsePosts = (posts, currentUserName) => { +export const parsePosts = (posts, currentUserName, areComments) => { if (posts) { - const formattedPosts = posts.map((post) => parsePost(post, currentUserName, false, true)); + const formattedPosts = posts.map((post) => + parsePost(post, currentUserName, false, true, areComments), + ); return formattedPosts; } return null; }; -export const parsePost = (post, currentUserName, isPromoted, isList = false) => { +export const parsePost = (post, currentUserName, isPromoted, isList = false, isComment = false) => { if (!post) { return null; } @@ -63,7 +65,7 @@ export const parsePost = (post, currentUserName, isPromoted, isList = false) => post.post_fetched_at = new Date().getTime(); //discard post body if list - if (isList) { + if (isList && !isComment) { post.body = ''; }