upadted promote posts

This commit is contained in:
ue 2019-08-24 12:51:12 +03:00
parent d17341a6a7
commit 89fce0e61f

View File

@ -203,25 +203,18 @@ class PostsView extends Component {
setFeedPosts(_posts); setFeedPosts(_posts);
} }
if (refreshing) {
_posts = _posts.filter(item => !item.is_promoted);
}
if (promotedPosts && promotedPosts.length > 0) { if (promotedPosts && promotedPosts.length > 0) {
promotedPosts.forEach((promotedItem, i) => { promotedPosts.forEach((promotedItem, i) => {
if (get(_posts, [(i + 1) * 3], {}).permlink !== promotedItem.permlink) { 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) { if (refreshing) {
this.setState({ this.setState({
posts: _posts, posts: _posts,