about summary refs log tree commit diff
path: root/app/assets/javascripts/components/reducers/compose.jsx
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-09-22 00:09:21 +0200
committerEugen Rochko <eugen@zeonfederated.com>2016-09-22 00:09:21 +0200
commitbc98865c1a97a350d98c1c295f6d67ef69ba5eb5 (patch)
tree05d6e3d6c7c404a3194319ef731a9cea4a542e65 /app/assets/javascripts/components/reducers/compose.jsx
parent94525b596ac67577a6b18b6cb7405a402e409616 (diff)
API returns mentions for statuses, compose form pre-fills all relevant usernames into the form when replying
Diffstat (limited to 'app/assets/javascripts/components/reducers/compose.jsx')
-rw-r--r--app/assets/javascripts/components/reducers/compose.jsx6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/assets/javascripts/components/reducers/compose.jsx b/app/assets/javascripts/components/reducers/compose.jsx
index 688c494c0..3974e40c6 100644
--- a/app/assets/javascripts/components/reducers/compose.jsx
+++ b/app/assets/javascripts/components/reducers/compose.jsx
@@ -23,6 +23,10 @@ const initialState = Immutable.Map({
   media_attachments: Immutable.List([])
 });
 
+function statusToTextMentions(status) {
+  return Immutable.OrderedSet([`@${status.getIn(['account', 'acct'])} `]).union(status.get('mentions').map(mention => `@${mention.get('acct')} `)).join('');
+};
+
 export default function compose(state = initialState, action) {
   switch(action.type) {
     case COMPOSE_CHANGE:
@@ -30,7 +34,7 @@ export default function compose(state = initialState, action) {
     case COMPOSE_REPLY:
       return state.withMutations(map => {
         map.set('in_reply_to', action.status.get('id'));
-        map.set('text', `@${action.status.getIn(['account', 'acct'])} `);
+        map.set('text', statusToTextMentions(action.status));
       });
     case COMPOSE_REPLY_CANCEL:
       return state.withMutations(map => {