diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2017-08-14 04:53:31 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-14 04:53:31 +0200 |
commit | 3c6503038ecad20f1b8fa0c9ea7e46087c6e3f22 (patch) | |
tree | 3da0736f8e6643260c8cea7176e583fcb0c46575 /app/javascript/mastodon/reducers/compose.js | |
parent | 96e9ed13ded6def1d96260178ee9d9e7ad3e5d23 (diff) |
Add protocol handler. Handle follow intents (#4511)
* Add protocol handler. Handle follow intents * Add share intent * Improve code in intents controller * Adjust share form CSS
Diffstat (limited to 'app/javascript/mastodon/reducers/compose.js')
-rw-r--r-- | app/javascript/mastodon/reducers/compose.js | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/app/javascript/mastodon/reducers/compose.js b/app/javascript/mastodon/reducers/compose.js index e137b774e..34f5dab7f 100644 --- a/app/javascript/mastodon/reducers/compose.js +++ b/app/javascript/mastodon/reducers/compose.js @@ -141,10 +141,20 @@ const privacyPreference = (a, b) => { } }; +const hydrate = (state, hydratedState) => { + state = clearAll(state.merge(hydratedState)); + + if (hydratedState.has('text')) { + state = state.set('text', hydratedState.get('text')); + } + + return state; +}; + export default function compose(state = initialState, action) { switch(action.type) { case STORE_HYDRATE: - return clearAll(state.merge(action.state.get('compose'))); + return hydrate(state, action.state.get('compose')); case COMPOSE_MOUNT: return state.set('mounted', true); case COMPOSE_UNMOUNT: |