about summary refs log tree commit diff
path: root/app/javascript/mastodon
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2022-03-09 13:01:44 +0100
committerGitHub <noreply@github.com>2022-03-09 13:01:44 +0100
commite54fd73df2f1b120e7986e161566802eb1aac464 (patch)
tree7e6c423f90d63972fda15c1272a4fcf69285c5de /app/javascript/mastodon
parentdb04dfc8a6422fd4b8080e43f5033cb6857d4e0f (diff)
Fix being able to add more than 4 hashtags to hashtag column in web UI (#17729)
Diffstat (limited to 'app/javascript/mastodon')
-rw-r--r--app/javascript/mastodon/features/hashtag_timeline/components/column_settings.js12
1 files changed, 11 insertions, 1 deletions
diff --git a/app/javascript/mastodon/features/hashtag_timeline/components/column_settings.js b/app/javascript/mastodon/features/hashtag_timeline/components/column_settings.js
index 142118cef..ede8907e5 100644
--- a/app/javascript/mastodon/features/hashtag_timeline/components/column_settings.js
+++ b/app/javascript/mastodon/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()) {