From 89fce0e61ffeed8555b137041a5e2acb715089ba Mon Sep 17 00:00:00 2001 From: ue Date: Sat, 24 Aug 2019 12:51:12 +0300 Subject: [PATCH] upadted promote posts --- src/components/posts/view/postsView.js | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/src/components/posts/view/postsView.js b/src/components/posts/view/postsView.js index 1e5ff5e7b..274be23ed 100644 --- a/src/components/posts/view/postsView.js +++ b/src/components/posts/view/postsView.js @@ -203,25 +203,18 @@ class PostsView extends Component { setFeedPosts(_posts); } + if (refreshing) { + _posts = _posts.filter(item => !item.is_promoted); + } + if (promotedPosts && promotedPosts.length > 0) { promotedPosts.forEach((promotedItem, i) => { if (get(_posts, [(i + 1) * 3], {}).permlink !== promotedItem.permlink) { - _posts.splice((i + 1) * 3, i * 3, promotedItem); + if (_posts[i * 3]) _posts.splice((i + 1) * 3, i * 3, promotedItem); } }); } - // if (promotedPosts && promotedPosts.length > 0) { - // if (refreshing) { - // _posts = _posts.filter((item, i) => !item.is_promoted); - // promotedPosts.forEach((promotedItem, i) => { - // _posts.splice((i + 1) * 3, i * 3, promotedItem); - // }); - // } else if (_posts.length < 11) { - // _posts.push(promotedPosts[_posts.length % 3]); - // } - // } - if (refreshing) { this.setState({ posts: _posts,