Skip to content

Commit

Permalink
Hide posts <65 reputation for not authorized
Browse files Browse the repository at this point in the history
  • Loading branch information
1aerostorm committed May 8, 2024
1 parent c52751d commit a5b535a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/components/cards/PostSummary.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
10 changes: 9 additions & 1 deletion app/utils/ContentAccess.js
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit a5b535a

Please sign in to comment.