diff --git a/public_html/js/Presenters/PostListPresenter.js b/public_html/js/Presenters/PostListPresenter.js index 30ed7cdf..fa0fbc5f 100644 --- a/public_html/js/Presenters/PostListPresenter.js +++ b/public_html/js/Presenters/PostListPresenter.js @@ -10,6 +10,7 @@ App.Presenters.PostListPresenter = function( api, keyboard, pagerPresenter, + browsingSettings, topNavigationPresenter) { var KEY_RETURN = 13; @@ -105,13 +106,32 @@ App.Presenters.PostListPresenter = function( function renderPosts($page, posts) { var $target = $page.find('.posts'); _.each(posts, function(post) { - var $post = renderPost(post); - softRenderPost($post); - $target.append($post); + if (!shouldSkipPost(post)) { + var $post = renderPost(post); + softRenderPost($post); + $target.append($post); + } }); windowResized(); } + function shouldSkipPost(post) { + var settings = browsingSettings.getSettings(); + if (post.ownScore < 0 && settings.hideDownvoted) { + return true; + } + if (settings.listPosts) { + if (post.safety === 'safe' && !settings.listPosts.safe) { + return true; + } else if (post.safety === 'sketchy' && !settings.listPosts.sketchy) { + return true; + } else if (post.safety === 'unsafe' && !settings.listPosts.unsafe) { + return true; + } + } + return false; + } + function renderPost(post) { var $post = jQuery('