Add glitch-soc local setting to display reply counters

Defaults to false.
signup-info-prompt
Thibaut Girka 2018-08-22 13:17:21 +02:00 committed by ThibG
parent d62ea55d51
commit 3c49daeb8d
4 changed files with 31 additions and 4 deletions

View File

@ -528,6 +528,7 @@ export default class Status extends ImmutablePureComponent {
{...other} {...other}
status={status} status={status}
account={status.get('account')} account={status.get('account')}
showReplyCount={settings.get('show_reply_count')}
/> />
) : null} ) : null}
{notification ? ( {notification ? (

View File

@ -66,6 +66,7 @@ export default class StatusActionBar extends ImmutablePureComponent {
onPin: PropTypes.func, onPin: PropTypes.func,
onBookmark: PropTypes.func, onBookmark: PropTypes.func,
withDismiss: PropTypes.bool, withDismiss: PropTypes.bool,
showReplyCount: PropTypes.bool,
intl: PropTypes.object.isRequired, intl: PropTypes.object.isRequired,
}; };
@ -73,6 +74,7 @@ export default class StatusActionBar extends ImmutablePureComponent {
// evaluate to false. See react-immutable-pure-component for usage. // evaluate to false. See react-immutable-pure-component for usage.
updateOnProps = [ updateOnProps = [
'status', 'status',
'showReplyCount',
'withDismiss', 'withDismiss',
] ]
@ -144,7 +146,7 @@ export default class StatusActionBar extends ImmutablePureComponent {
} }
render () { render () {
const { status, intl, withDismiss } = this.props; const { status, intl, withDismiss, showReplyCount } = this.props;
const mutingConversation = status.get('muted'); const mutingConversation = status.get('muted');
const anonymousAccess = !me; 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} /> <IconButton className='status__action-bar-button' title={intl.formatMessage(messages.share)} icon='share-alt' onClick={this.handleShareClick} />
); );
return ( let replyButton = (
<div className='status__action-bar'> <IconButton
className='status__action-bar-button'
disabled={anonymousAccess}
title={replyTitle}
icon={replyIcon}
onClick={this.handleReplyClick}
/>
);
if (showReplyCount) {
replyButton = (
<div className='status__action-bar__counter'> <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> <span className='status__action-bar__counter__label' >{obfuscatedCount(status.get('replies_count'))}</span>
</div> </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' 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} /> <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} {shareButton}

View File

@ -33,6 +33,14 @@ export default class LocalSettingsPage extends React.PureComponent {
({ intl, onChange, settings }) => ( ({ intl, onChange, settings }) => (
<div className='glitch local-settings__page general'> <div className='glitch local-settings__page general'>
<h1><FormattedMessage id='settings.general' defaultMessage='General' /></h1> <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> <section>
<h2><FormattedMessage id='settings.layout_opts' defaultMessage='Layout options' /></h2> <h2><FormattedMessage id='settings.layout_opts' defaultMessage='Layout options' /></h2>
<LocalSettingsPageItem <LocalSettingsPageItem

View File

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