Add glitch-soc local setting to display reply counters

Defaults to false.
master
Thibaut Girka 6 years ago committed by ThibG
parent d62ea55d51
commit 3c49daeb8d
  1. 1
      app/javascript/flavours/glitch/components/status.js
  2. 25
      app/javascript/flavours/glitch/components/status_action_bar.js
  3. 8
      app/javascript/flavours/glitch/features/local_settings/page/index.js
  4. 1
      app/javascript/flavours/glitch/reducers/local_settings.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 ? (

@ -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 {
<IconButton className='status__action-bar-button' title={intl.formatMessage(messages.share)} icon='share-alt' onClick={this.handleShareClick} />
);
return (
<div className='status__action-bar'>
let replyButton = (
<IconButton
className='status__action-bar-button'
disabled={anonymousAccess}
title={replyTitle}
icon={replyIcon}
onClick={this.handleReplyClick}
/>
);
if (showReplyCount) {
replyButton = (
<div className='status__action-bar__counter'>
<IconButton className='status__action-bar-button' disabled={anonymousAccess} title={replyTitle} icon={replyIcon} onClick={this.handleReplyClick} />
{replyButton}
<span className='status__action-bar__counter__label' >{obfuscatedCount(status.get('replies_count'))}</span>
</div>
);
}
return (
<div className='status__action-bar'>
{replyButton}
<IconButton className='status__action-bar-button' disabled={reblogDisabled} active={status.get('reblogged')} pressed={status.get('reblogged')} title={reblogDisabled ? intl.formatMessage(messages.cannot_reblog) : intl.formatMessage(reblogMessage)} icon={reblogIcon} onClick={this.handleReblogClick} />
<IconButton className='status__action-bar-button star-icon' disabled={anonymousAccess} animate active={status.get('favourited')} pressed={status.get('favourited')} title={intl.formatMessage(messages.favourite)} icon='star' onClick={this.handleFavouriteClick} />
{shareButton}

@ -33,6 +33,14 @@ export default class LocalSettingsPage extends React.PureComponent {
({ intl, onChange, settings }) => (
<div className='glitch local-settings__page general'>
<h1><FormattedMessage id='settings.general' defaultMessage='General' /></h1>
<LocalSettingsPageItem
settings={settings}
item={['show_reply_count']}
id='mastodon-settings--reply-count'
onChange={onChange}
>
<FormattedMessage id='settings.show_reply_counter' defaultMessage='Display an estimate of the reply count' />
</LocalSettingsPageItem>
<section>
<h2><FormattedMessage id='settings.layout_opts' defaultMessage='Layout options' /></h2>
<LocalSettingsPageItem

@ -11,6 +11,7 @@ const initialState = ImmutableMap({
navbar_under : false,
side_arm : 'none',
side_arm_reply_mode : 'keep',
show_reply_count : false,
collapsed : ImmutableMap({
enabled : true,
auto : ImmutableMap({

Loading…
Cancel
Save