diff --git a/.env.production.sample b/.env.production.sample index 326c2cc409..b604c4b04d 100644 --- a/.env.production.sample +++ b/.env.production.sample @@ -270,7 +270,7 @@ MAX_POLL_OPTIONS=5 MAX_POLL_OPTION_CHARS=100 # Maximum number of emoji reactions per toot and user (minimum 1) -MAX_REACTIONS=8 +MAX_REACTIONS=1 # Maximum image and video/audio upload sizes # Units are in bytes diff --git a/app/javascript/flavours/glitch/components/status.js b/app/javascript/flavours/glitch/components/status.js index 70c1a99910..04145a384b 100644 --- a/app/javascript/flavours/glitch/components/status.js +++ b/app/javascript/flavours/glitch/components/status.js @@ -808,6 +808,7 @@ class Status extends ImmutablePureComponent { { - const { addReaction, statusId } = this.props; - addReaction(statusId, data.native.replace(/:/g, '')); - } - willEnter() { return { scale: reduceMotion ? 1 : 0 }; } @@ -35,11 +31,18 @@ export default class StatusReactions extends ImmutablePureComponent { } render() { - const { reactions } = this.props; - const visibleReactions = reactions + const { reactions, numVisible } = this.props; + let visibleReactions = reactions .filter(x => x.get('count') > 0) - .sort((a, b) => b.get('count') - a.get('count')) - .filter((_, i) => i < maxReactions); + .sort((a, b) => b.get('count') - a.get('count')); + + // numVisible might be NaN because it's pulled from local settings + // which doesn't do a whole lot of input validation, but that's okay + // because NaN >= 0 evaluates false. + // Still, this should be improved at some point. + if (numVisible >= 0) { + visibleReactions = visibleReactions.filter((_, i) => i < numVisible); + } const styles = visibleReactions.map(reaction => ({ key: reaction.get('name'), 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 d01eec811e..e88e50b674 100644 --- a/app/javascript/flavours/glitch/features/local_settings/page/index.js +++ b/app/javascript/flavours/glitch/features/local_settings/page/index.js @@ -29,6 +29,8 @@ const messages = defineMessages({ rewrite_mentions_username: { id: 'settings.rewrite_mentions_username', defaultMessage: 'Rewrite with username' }, pop_in_left: { id: 'settings.pop_in_left', defaultMessage: 'Left' }, pop_in_right: { id: 'settings.pop_in_right', defaultMessage: 'Right' }, + visible_reactions_count: { id: 'settings.visible_reactions_count', defaultMessage: 'Number of visible reactions' }, + enter_amount_prompt: { id: 'settings.enter_amount_prompt', defaultMessage: 'Enter an amount' }, }); export default @injectIntl @@ -92,6 +94,16 @@ class LocalSettingsPage extends React.PureComponent { > + + +

{ const { target } = e; - const { item, onChange, options, placeholder } = this.props; + const { item, onChange, options, placeholder, number } = this.props; if (options && options.length > 0) onChange(item, target.value); - else if (placeholder) onChange(item, target.value); + else if (placeholder) onChange(item, number ? parseInt(target.value) : target.value); else onChange(item, target.checked); } render () { const { handleChange } = this; - const { settings, item, id, options, children, dependsOn, dependsOnNot, placeholder, disabled } = this.props; + const { settings, item, id, options, children, dependsOn, dependsOnNot, placeholder, number, disabled } = this.props; let enabled = !disabled; if (dependsOn) { @@ -76,7 +77,7 @@ export default class LocalSettingsPageItem extends React.PureComponent { ); - } else if (placeholder) { + } else if (placeholder || number) { return (