skipping body removal for comments list

This commit is contained in:
Nouman Tahir 2021-03-23 11:41:03 +05:00
parent b102e149a7
commit 7222075bf7
2 changed files with 10 additions and 10 deletions

View File

@ -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);

View File

@ -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 = '';
}