From 665ade7fae81e9a57592219308811c8fa8e8af58 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Wed, 9 Mar 2022 13:01:44 +0100 Subject: [PATCH] [Glitch] Fix being able to add more than 4 hashtags to hashtag column in web UI Port 380aef66ae23af8dc8406ba4d169a9cb775dde35 to glitch-soc Signed-off-by: Claire --- .../hashtag_timeline/components/column_settings.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/javascript/flavours/glitch/features/hashtag_timeline/components/column_settings.js b/app/javascript/flavours/glitch/features/hashtag_timeline/components/column_settings.js index 142118cefc..ede8907e50 100644 --- a/app/javascript/flavours/glitch/features/hashtag_timeline/components/column_settings.js +++ b/app/javascript/flavours/glitch/features/hashtag_timeline/components/column_settings.js @@ -40,7 +40,17 @@ class ColumnSettings extends React.PureComponent { } }; - onSelect = mode => value => this.props.onChange(['tags', mode], value); + onSelect = mode => value => { + const oldValue = this.tags(mode); + + // Prevent changes that add more than 4 tags, but allow removing + // tags that were already added before + if ((value.length > 4) && !(value < oldValue)) { + return; + } + + this.props.onChange(['tags', mode], value); + }; onToggle = () => { if (this.state.open && this.hasTags()) {