diff --git a/README.md b/README.md index d85d2143..617c3927 100644 --- a/README.md +++ b/README.md @@ -489,6 +489,7 @@ type Comment struct { Locator Locator `json:"locator"` // post locator Score int `json:"score"` // comment score, read only Votes map[string]bool `json:"votes"` // comment votes, read only + Controversy float64 `json:"controversy,omitempty"` // comment controversy, read only Timestamp time.Time `json:"time"` // time stamp, read only Pin bool `json:"pin"` // pinned status, read only Delete bool `json:"delete"` // delete status, read only diff --git a/web/app/components/auth-panel/auth-panel.jsx b/web/app/components/auth-panel/auth-panel.jsx index 2a3f8d51..c9b0b207 100644 --- a/web/app/components/auth-panel/auth-panel.jsx +++ b/web/app/components/auth-panel/auth-panel.jsx @@ -187,6 +187,14 @@ function getSortArray(currentSort) { value: '+active', label: 'Least recently updated', }, + { + value: '-controversy', + label: 'Most controversial', + }, + { + value: '+controversy', + label: 'Least controversial', + }, ]; return sortArray.map(sort => { diff --git a/web/app/components/comment/comment.jsx b/web/app/components/comment/comment.jsx index d22cd46f..5d7efd71 100644 --- a/web/app/components/comment/comment.jsx +++ b/web/app/components/comment/comment.jsx @@ -446,6 +446,7 @@ export default class Comment extends Component { const o = { ...data, + controversyText: `Controversy: ${(data.controversy || 0).toFixed(2)}`, text: data.text.length ? mods.view === 'preview' ? getTextSnippet(data.text) @@ -597,7 +598,7 @@ export default class Comment extends Component { Vote up - + {o.score.sign} {o.score.value}