From 3c49daeb8d93010dc072de82e06a016bac7dbf16 Mon Sep 17 00:00:00 2001 From: Thibaut Girka Date: Wed, 22 Aug 2018 13:17:21 +0200 Subject: Add glitch-soc local setting to display reply counters Defaults to false. --- .../flavours/glitch/components/status.js | 1 + .../glitch/components/status_action_bar.js | 25 ++++++++++++++++++---- .../glitch/features/local_settings/page/index.js | 8 +++++++ .../flavours/glitch/reducers/local_settings.js | 1 + 4 files changed, 31 insertions(+), 4 deletions(-) (limited to 'app/javascript') diff --git a/app/javascript/flavours/glitch/components/status.js b/app/javascript/flavours/glitch/components/status.js index da1f74e6d..a87721ef8 100644 --- a/app/javascript/flavours/glitch/components/status.js +++ b/app/javascript/flavours/glitch/components/status.js @@ -528,6 +528,7 @@ export default class Status extends ImmutablePureComponent { {...other} status={status} account={status.get('account')} + showReplyCount={settings.get('show_reply_count')} /> ) : null} {notification ? ( diff --git a/app/javascript/flavours/glitch/components/status_action_bar.js b/app/javascript/flavours/glitch/components/status_action_bar.js index 70aada0e9..8a840030a 100644 --- a/app/javascript/flavours/glitch/components/status_action_bar.js +++ b/app/javascript/flavours/glitch/components/status_action_bar.js @@ -66,6 +66,7 @@ export default class StatusActionBar extends ImmutablePureComponent { onPin: PropTypes.func, onBookmark: PropTypes.func, withDismiss: PropTypes.bool, + showReplyCount: PropTypes.bool, intl: PropTypes.object.isRequired, }; @@ -73,6 +74,7 @@ export default class StatusActionBar extends ImmutablePureComponent { // evaluate to false. See react-immutable-pure-component for usage. updateOnProps = [ 'status', + 'showReplyCount', 'withDismiss', ] @@ -144,7 +146,7 @@ export default class StatusActionBar extends ImmutablePureComponent { } render () { - const { status, intl, withDismiss } = this.props; + const { status, intl, withDismiss, showReplyCount } = this.props; const mutingConversation = status.get('muted'); const anonymousAccess = !me; @@ -198,12 +200,27 @@ export default class StatusActionBar extends ImmutablePureComponent { ); - return ( -
+ let replyButton = ( + + ); + if (showReplyCount) { + replyButton = (
- + {replyButton} {obfuscatedCount(status.get('replies_count'))}
+ ); + } + + return ( +
+ {replyButton} {shareButton} diff --git a/app/javascript/flavours/glitch/features/local_settings/page/index.js b/app/javascript/flavours/glitch/features/local_settings/page/index.js index 5608066b0..f88e23c47 100644 --- a/app/javascript/flavours/glitch/features/local_settings/page/index.js +++ b/app/javascript/flavours/glitch/features/local_settings/page/index.js @@ -33,6 +33,14 @@ export default class LocalSettingsPage extends React.PureComponent { ({ intl, onChange, settings }) => (

+ + +