about summary refs log tree commit diff
path: root/app/javascript/flavours
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2022-03-09 13:01:44 +0100
committerClaire <claire.github-309c@sitedethib.com>2022-03-10 10:15:36 +0100
commit60021f7edb2864edb8ce474b17a7e8255fb97782 (patch)
tree57c06701ce50928e9bf6e6fe33075fcea54837b9 /app/javascript/flavours
parent887d56aa8a4ed7c61bb8259ee2bc82016403b579 (diff)
[Glitch] Fix being able to add more than 4 hashtags to hashtag column in web UI
Port e54fd73df2f1b120e7986e161566802eb1aac464 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
Diffstat (limited to 'app/javascript/flavours')
-rw-r--r--app/javascript/flavours/glitch/features/hashtag_timeline/components/column_settings.js12
1 files changed, 11 insertions, 1 deletions
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 142118cef..ede8907e5 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()) {