From e31adac1603d87b96727021f126f61c72e0953fd Mon Sep 17 00:00:00 2001 From: u-e <ugurerdal93@gmail.com> Date: Thu, 14 Mar 2019 20:43:49 +0300 Subject: [PATCH 1/3] weird changes --- .../Target Support Files/Pods-esteem/Pods-esteem.debug.xcconfig | 1 + .../Pods-esteem/Pods-esteem.release.xcconfig | 1 + .../Pods-esteemTests/Pods-esteemTests.debug.xcconfig | 1 + .../Pods-esteemTests/Pods-esteemTests.release.xcconfig | 1 + 4 files changed, 4 insertions(+) diff --git a/ios/Pods/Target Support Files/Pods-esteem/Pods-esteem.debug.xcconfig b/ios/Pods/Target Support Files/Pods-esteem/Pods-esteem.debug.xcconfig index 0695013b2..d39c7d90b 100644 --- a/ios/Pods/Target Support Files/Pods-esteem/Pods-esteem.debug.xcconfig +++ b/ios/Pods/Target Support Files/Pods-esteem/Pods-esteem.debug.xcconfig @@ -9,3 +9,4 @@ PODS_BUILD_DIR = ${BUILD_DIR} PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) PODS_PODFILE_DIR_PATH = ${SRCROOT}/. PODS_ROOT = ${SRCROOT}/Pods +USER_HEADER_SEARCH_PATHS = $(inherited) $(SRCROOT)/FLAnimatedImage/FLAnimatedImage diff --git a/ios/Pods/Target Support Files/Pods-esteem/Pods-esteem.release.xcconfig b/ios/Pods/Target Support Files/Pods-esteem/Pods-esteem.release.xcconfig index 0695013b2..d39c7d90b 100644 --- a/ios/Pods/Target Support Files/Pods-esteem/Pods-esteem.release.xcconfig +++ b/ios/Pods/Target Support Files/Pods-esteem/Pods-esteem.release.xcconfig @@ -9,3 +9,4 @@ PODS_BUILD_DIR = ${BUILD_DIR} PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) PODS_PODFILE_DIR_PATH = ${SRCROOT}/. PODS_ROOT = ${SRCROOT}/Pods +USER_HEADER_SEARCH_PATHS = $(inherited) $(SRCROOT)/FLAnimatedImage/FLAnimatedImage diff --git a/ios/Pods/Target Support Files/Pods-esteemTests/Pods-esteemTests.debug.xcconfig b/ios/Pods/Target Support Files/Pods-esteemTests/Pods-esteemTests.debug.xcconfig index 1a1659871..e629a3239 100644 --- a/ios/Pods/Target Support Files/Pods-esteemTests/Pods-esteemTests.debug.xcconfig +++ b/ios/Pods/Target Support Files/Pods-esteemTests/Pods-esteemTests.debug.xcconfig @@ -8,3 +8,4 @@ PODS_BUILD_DIR = ${BUILD_DIR} PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) PODS_PODFILE_DIR_PATH = ${SRCROOT}/. PODS_ROOT = ${SRCROOT}/Pods +USER_HEADER_SEARCH_PATHS = $(inherited) $(SRCROOT)/FLAnimatedImage/FLAnimatedImage diff --git a/ios/Pods/Target Support Files/Pods-esteemTests/Pods-esteemTests.release.xcconfig b/ios/Pods/Target Support Files/Pods-esteemTests/Pods-esteemTests.release.xcconfig index 1a1659871..e629a3239 100644 --- a/ios/Pods/Target Support Files/Pods-esteemTests/Pods-esteemTests.release.xcconfig +++ b/ios/Pods/Target Support Files/Pods-esteemTests/Pods-esteemTests.release.xcconfig @@ -8,3 +8,4 @@ PODS_BUILD_DIR = ${BUILD_DIR} PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) PODS_PODFILE_DIR_PATH = ${SRCROOT}/. PODS_ROOT = ${SRCROOT}/Pods +USER_HEADER_SEARCH_PATHS = $(inherited) $(SRCROOT)/FLAnimatedImage/FLAnimatedImage From 0cfeda776c0bdc79659c66f850583269dd27be61 Mon Sep 17 00:00:00 2001 From: u-e <ugurerdal93@gmail.com> Date: Thu, 14 Mar 2019 21:57:33 +0300 Subject: [PATCH 2/3] fixed edit bug --- src/utils/postParser.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/utils/postParser.js b/src/utils/postParser.js index c621bc034..14aede2cc 100644 --- a/src/utils/postParser.js +++ b/src/utils/postParser.js @@ -3,14 +3,18 @@ import { markDown2Html } from './markdownToHtml'; import { getPostSummary } from './formatter'; import { getReputation } from './reputation'; -export const parsePosts = (posts, currentUserName, isSummary) => (!posts ? null : posts.map(post => parsePost(post, currentUserName, isSummary))); +export const parsePosts = (posts, currentUserName) => (!posts ? null : posts.map(post => parsePost(post, currentUserName))); -export const parsePost = (post, currentUserName, isSummary = false) => { +export const parsePost = (post, currentUserName) => { if (!post) { return null; } const _post = post; + if (currentUserName === _post.author) { + _post.markdownBody = post.body; + } + _post.json_metadata = JSON.parse(post.json_metadata); _post.image = postImage(post.json_metadata, post.body); _post.vote_count = post.active_votes.length; @@ -28,10 +32,6 @@ export const parsePost = (post, currentUserName, isSummary = false) => { _post.is_voted = false; } - if (currentUserName === _post.author) { - _post.markdownBody = post.body; - } - const totalPayout = parseFloat(_post.pending_payout_value) + parseFloat(_post.total_payout_value) + parseFloat(_post.curator_payout_value); From be9038dcd7b29351d2a4a283b6bd635acf47460f Mon Sep 17 00:00:00 2001 From: u-e <ugurerdal93@gmail.com> Date: Thu, 14 Mar 2019 22:08:05 +0300 Subject: [PATCH 3/3] updated a bit --- src/utils/postParser.js | 57 ++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 29 deletions(-) diff --git a/src/utils/postParser.js b/src/utils/postParser.js index 14aede2cc..426fd9877 100644 --- a/src/utils/postParser.js +++ b/src/utils/postParser.js @@ -9,52 +9,51 @@ export const parsePost = (post, currentUserName) => { if (!post) { return null; } - const _post = post; - if (currentUserName === _post.author) { - _post.markdownBody = post.body; + if (currentUserName === post.author) { + post.markdownBody = post.body; } - _post.json_metadata = JSON.parse(post.json_metadata); - _post.image = postImage(post.json_metadata, post.body); - _post.vote_count = post.active_votes.length; - _post.author_reputation = getReputation(post.author_reputation); - _post.avatar = `https://steemitimages.com/u/${post.author}/avatar/small`; - _post.active_votes.sort((a, b) => b.rshares - a.rshares); + post.json_metadata = JSON.parse(post.json_metadata); + post.image = postImage(post.json_metadata, post.body); + post.vote_count = post.active_votes.length; + post.author_reputation = getReputation(post.author_reputation); + post.avatar = `https://steemitimages.com/u/${post.author}/avatar/small`; + post.active_votes.sort((a, b) => b.rshares - a.rshares); - _post.body = markDown2Html(post.body); - _post.summary = getPostSummary(post.body, 150); - _post.is_declined_payout = Number(parseFloat(post.max_accepted_payout)) === 0; + post.body = markDown2Html(post.body); + post.summary = getPostSummary(post.body, 150); + post.is_declined_payout = Number(parseFloat(post.max_accepted_payout)) === 0; if (currentUserName) { - _post.is_voted = isVoted(_post.active_votes, currentUserName); + post.is_voted = isVoted(post.active_votes, currentUserName); } else { - _post.is_voted = false; + post.is_voted = false; } - const totalPayout = parseFloat(_post.pending_payout_value) - + parseFloat(_post.total_payout_value) - + parseFloat(_post.curator_payout_value); + const totalPayout = parseFloat(post.pending_payout_value) + + parseFloat(post.total_payout_value) + + parseFloat(post.curator_payout_value); - _post.total_payout = totalPayout.toFixed(3); + post.total_payout = totalPayout.toFixed(3); - const voteRshares = _post.active_votes.reduce((a, b) => a + parseFloat(b.rshares), 0); + const voteRshares = post.active_votes.reduce((a, b) => a + parseFloat(b.rshares), 0); const ratio = totalPayout / voteRshares; - if (_post.active_votes && _post.active_votes.length > 0) { - for (const i in _post.active_votes) { - _post.vote_perecent = post.active_votes[i].voter === currentUserName ? post.active_votes[i].percent : null; - _post.active_votes[i].value = (post.active_votes[i].rshares * ratio).toFixed(3); - _post.active_votes[i].reputation = getReputation(post.active_votes[i].reputation); - _post.active_votes[i].percent = post.active_votes[i].percent / 100; - _post.active_votes[i].is_down_vote = Math.sign(post.active_votes[i].percent) < 0; - _post.active_votes[i].avatar = `https://steemitimages.com/u/${ - _post.active_votes[i].voter + if (post.active_votes && post.active_votes.length > 0) { + for (const i in post.active_votes) { + post.vote_perecent = post.active_votes[i].voter === currentUserName ? post.active_votes[i].percent : null; + post.active_votes[i].value = (post.active_votes[i].rshares * ratio).toFixed(3); + post.active_votes[i].reputation = getReputation(post.active_votes[i].reputation); + post.active_votes[i].percent = post.active_votes[i].percent / 100; + post.active_votes[i].is_down_vote = Math.sign(post.active_votes[i].percent) < 0; + post.active_votes[i].avatar = `https://steemitimages.com/u/${ + post.active_votes[i].voter }/avatar/small`; } } - return _post; + return post; }; const isVoted = (activeVotes, currentUserName) => activeVotes.some(v => v.voter === currentUserName && v.percent > 0);