From a5b535ad32a8bbafff192022da7ce322baaa694d Mon Sep 17 00:00:00 2001 From: 1aerostorm Date: Wed, 8 May 2024 22:07:43 +0300 Subject: [PATCH] Hide posts <65 reputation for not authorized --- app/components/cards/PostSummary.jsx | 1 + app/utils/ContentAccess.js | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/components/cards/PostSummary.jsx b/app/components/cards/PostSummary.jsx index 9d87631a..77a0ca07 100644 --- a/app/components/cards/PostSummary.jsx +++ b/app/components/cards/PostSummary.jsx @@ -191,6 +191,7 @@ class PostSummary extends React.Component { if (hideSummary({ author: content.get('author'), url: content.get('url'), + author_reputation: content.get('author_reputation'), app: content.get('app'), currentCategory, isNsfw, isOnlyblog, isOnlyapp, diff --git a/app/utils/ContentAccess.js b/app/utils/ContentAccess.js index 32f9eeea..9a753f56 100644 --- a/app/utils/ContentAccess.js +++ b/app/utils/ContentAccess.js @@ -1,5 +1,6 @@ import { isBlocked } from 'app/utils/blacklist' import session from 'app/utils/session' +import { repLog10 } from 'app/utils/ParsersAndFormatters' function hasLS() { return typeof(localStorage) !== 'undefined' @@ -63,7 +64,7 @@ export function hideContent(net_rshares, author_rep) { // Hide from all post lists (Blog, Feed, and New/Popular/etc.) // and comment lists (/comments, /recent-replies) -export function hideSummary({ author, url, app, currentCategory, isNsfw, isOnlyblog, isOnlyapp, +export function hideSummary({ author, author_reputation, url, app, currentCategory, isNsfw, isOnlyblog, isOnlyapp, username, nsfwPref }) { const isNotAuthorized = !username const isMyPost = username === author @@ -93,6 +94,13 @@ export function hideSummary({ author, url, app, currentCategory, isNsfw, isOnlyb return true } + if (isNotAuthorized && author_reputation !== undefined) { + const author_rep = repLog10(author_reputation) + if (author_rep < 65 && currentCategory !== 'blog') { + return true + } + } + return false }