Fixed replies markdown issue

This commit is contained in:
Mustafa Buyukcelebi 2019-08-01 16:19:04 +03:00
parent 4db695ab44
commit 363d036067
2 changed files with 11 additions and 14 deletions

View File

@ -321,9 +321,9 @@ export const getPostsSummary = async (by, query, currentUserName, filterNsfw) =>
export const getUserComments = async query => {
try {
let comments = await client.database.getDiscussions('comments', query);
comments = await parseComments(comments);
return comments;
const comments = await client.database.getDiscussions('comments', query);
const groomedComments = await parseComments(comments);
return groomedComments;
} catch (error) {
return error;
}
@ -331,13 +331,13 @@ export const getUserComments = async query => {
export const getRepliesByLastUpdate = async query => {
try {
let replies = await client.database.call('get_replies_by_last_update', [
const replies = await client.database.call('get_replies_by_last_update', [
query.start_author,
query.start_permlink,
query.limit,
]);
replies = await parseComments(replies);
return replies;
const groomedComments = await parseComments(replies);
return groomedComments;
} catch (error) {
return error;
}
@ -405,15 +405,11 @@ export const deleteComment = (currentAccount, pin, permlink) => {
}
};
const wait = ms => new Promise(r => setTimeout(r, ms));
export const getComments = async (author, permlink, currentUserName = null) => {
try {
const comments = await client.database.call('get_content_replies', [author, permlink]);
const groomedComments = await parseComments(comments, currentUserName);
// WORK ARROUND
await wait(comments && comments.length * 30);
return comments ? groomedComments : null;
} catch (error) {

View File

@ -102,7 +102,7 @@ const postImage = (metaData, body) => {
};
export const parseComments = async (comments, currentUserName) => {
const _comments = await comments.map(async comment => {
const pArray = comments.map(async comment => {
const activeVotes = await getActiveVotes(get(comment, 'author'), get(comment, 'permlink'));
comment.pending_payout_value = parseFloat(
@ -120,11 +120,12 @@ export const parseComments = async (comments, currentUserName) => {
} else {
comment.is_voted = false;
}
return _comments;
return comment;
});
return comments;
const _comments = await Promise.all(pArray);
return _comments;
};
const isVoted = (activeVotes, currentUserName) =>