Skip to content

Commit

Permalink
Update reputation score. Uses updates in steemd.
Browse files Browse the repository at this point in the history
  • Loading branch information
James Calfee committed Aug 3, 2016
1 parent 262bbfd commit 88225ed
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 10 deletions.
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,6 @@ find node_modules/eslint-config-airbnb -name '*.js'|xargs sed -i "s/': 2/': 1/"
"react/sort-comp": [1, { "order": [ 'lifecycle' ] }],
"react/prefer-stateless-function": 0,
"react/prop-types": 0,
"radix": 0,
}
}
2 changes: 1 addition & 1 deletion app/components/cards/Comment.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ class CommentImpl extends React.Component {
const {PostReplyEditor, PostEditEditor, showReply, showEdit, hide_body} = this.state
const Editor = showReply ? PostReplyEditor : PostEditEditor

const negative_comment = ignore || authorRepLog10 <= -6
const negative_comment = ignore || authorRepLog10 < 0 // rephide
const auto_hide = !showNegativeComments && negative_comment && comment.replies.length === 0 && !hasPendingPayout
if(!showNegativeComments && (auto_hide || hide_body)) {
if(onHide) onHide()
Expand Down
4 changes: 2 additions & 2 deletions app/components/cards/PostSummary.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {authorNameAndRep} from 'app/utils/ComponentFormatters'

function TimeAuthorCategory({post, links, authorRepLog10}) {
const author = <Tooltip t={authorRepLog10 ? authorRepLog10 + ' Reputation' : ''}>
<span className={authorRepLog10 <= -5 ? 'darkred' : ''}>
<span className={authorRepLog10 < 1 ? 'darkred' : '' /*rephide*/}>
{authorNameAndRep(post.author, authorRepLog10)}
</span>
</Tooltip>
Expand Down Expand Up @@ -115,7 +115,7 @@ export default class PostSummary extends React.Component {
}
}
const commentClasses = []
if(netVoteSign < 0 || authorRepLog10 <= -5) commentClasses.push('downvoted')
if(netVoteSign < 0 || authorRepLog10 < 1) commentClasses.push('downvoted') // rephide
return (
<article className={'PostSummary hentry' + (thumb ? ' with-image ' : ' ') + commentClasses.join(' ')} itemScope itemType ="http://schema.org/blogPost">
<div className="float-right"><Voting post={post} flag /></div>
Expand Down
2 changes: 1 addition & 1 deletion app/components/cards/PostsList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export default connect(
const username = current ? current.get('username') : null
const ignore = !hasPendingPayout && username ? state.global.getIn(['follow', 'get_following', username, 'result', content.get('author')], List()).contains('ignore') : false
const authorRepLog10 = repLog10(content.get('author_reputation'))
const hide = !hasPendingPayout && (ignore || authorRepLog10 <= -6)
const hide = !hasPendingPayout && (ignore || authorRepLog10 < 0) // rephide
if(!hide || showSpam)
comments.push({item, ignore, netVoteSign, authorRepLog10})
})
Expand Down
14 changes: 8 additions & 6 deletions app/utils/ParsersAndFormatters.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ export function parsePayoutAmount(amount) {

// This is a rough approximation of log10 that works with huge digit-strings.
function log10(str) {
let leadingDigits = parseInt(str.substring(0, 4));
let log = Math.log(leadingDigits) / Math.log(10)
let n = str.length - 1;
const leadingDigits = parseInt(str.substring(0, 4));
const log = Math.log(leadingDigits) / Math.log(10)
const n = str.length - 1;
return n + (log - parseInt(log));
}

Expand All @@ -42,8 +42,10 @@ export const repLog10 = rep2 => {
let rep = String(rep2)
const neg = rep.charAt(0) === '-'
rep = neg ? rep.substring(1) : rep
rep = log10(rep) + 1
let out = Math.max(rep - 8, 1);
let out = log10(rep)
out = Math.max(out - 8, 0); // -8 to remove reputation Satoshis
out = (neg ? -1 : 1) * out
return Math.round(out * 100) / 100.0 // return 2 dec points
out += 4 // set the base-line 0 to darken and < 0 to auto hide (grep rephide)
out = Math.round(out * 100) / 100.0 // return 2 dec points
return out
}

0 comments on commit 88225ed

Please sign in to comment.