about summary refs log tree commit diff
path: root/app/javascript
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2018-07-23 18:35:17 +0200
committerThibG <thib@sitedethib.com>2018-07-28 23:25:57 +0200
commit93d4e9a58d68ce5a996f262d64603775a31dd1f1 (patch)
treead929fe3a07d86dd9c470c98f3c9e1987da145bb /app/javascript
parent28a59e4e803eade3caf2804e58d34eeab23882c2 (diff)
Preserve hashtags in threaded mode (fixes #584)
Diffstat (limited to 'app/javascript')
-rw-r--r--app/javascript/flavours/glitch/reducers/compose.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/app/javascript/flavours/glitch/reducers/compose.js b/app/javascript/flavours/glitch/reducers/compose.js
index 4ea87b7e5..53dd65b07 100644
--- a/app/javascript/flavours/glitch/reducers/compose.js
+++ b/app/javascript/flavours/glitch/reducers/compose.js
@@ -113,6 +113,12 @@ function apiStatusToTextMentions (state, status) {
   )).join('');
 }
 
+function apiStatusToTextHashtags (state, status) {
+  return ImmutableOrderedSet([]).union(status.tags.map(
+    ({ name }) => `#${name} `
+  )).join('');
+}
+
 function clearAll(state) {
   return state.withMutations(map => {
     map.set('text', '');
@@ -133,7 +139,9 @@ function clearAll(state) {
 
 function continueThread (state, status) {
   return state.withMutations(function (map) {
-    map.set('text', apiStatusToTextMentions(state, status));
+    let text = apiStatusToTextMentions(state, status);
+    text = text + apiStatusToTextHashtags(state, status);
+    map.set('text', text);
     if (status.spoiler_text) {
       map.set('spoiler', true);
       map.set('spoiler_text', status.spoiler_text);