about summary refs log tree commit diff
diff options
context:
space:
mode:
authorIgor Galić <igalic@brainsware.at>2018-09-12 14:22:06 +0200
committerThibG <thib@sitedethib.com>2018-09-13 22:32:03 +0200
commit8433bd89e431d5834e4252c7ca197771944aa6d1 (patch)
treee602665d2434639e141b42677e75eff62eab3570
parentc3ab2973c5383f66fa64b95d2036b89cb5dc6678 (diff)
prepend re: to replies to spoiler-text
if spoiler-text doesn't already start with re:, we prepend `re: `
ourselves in replies.

This implements https://github.com/tootsuite/mastodon/issues/8667
Following Plemora's example: https://git.pleroma.social/pleroma/pleroma-fe/merge_requests/318
-rw-r--r--app/javascript/flavours/glitch/reducers/compose.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/javascript/flavours/glitch/reducers/compose.js b/app/javascript/flavours/glitch/reducers/compose.js
index 594d70ee2..0ddff707e 100644
--- a/app/javascript/flavours/glitch/reducers/compose.js
+++ b/app/javascript/flavours/glitch/reducers/compose.js
@@ -314,8 +314,12 @@ export default function compose(state = initialState, action) {
       map.set('idempotencyKey', uuid());
 
       if (action.status.get('spoiler_text').length > 0) {
+        let spoiler_text = action.status.get('spoiler_text');
+        if (!spoiler_text.match(/^re[: ]/i)) {
+          spoiler_text = 're: '.concat(spoiler_text);
+        }
         map.set('spoiler', true);
-        map.set('spoiler_text', action.status.get('spoiler_text'));
+        map.set('spoiler_text', spoiler_text);
       } else {
         map.set('spoiler', false);
         map.set('spoiler_text', '');