diff options
author | blackle <isabelle@blackle-mori.com> | 2017-01-12 23:54:26 -0500 |
---|---|---|
committer | blackle <isabelle@blackle-mori.com> | 2017-01-23 21:07:40 -0500 |
commit | bf0f6eb62d0f5bd1f0d8e4e2a6e9e8fd3b297b6c (patch) | |
tree | c06ebcba34c5971d564beb98aa81d5d9784ec2c7 /app/assets/javascripts/components/reducers | |
parent | 1761d3f9c33f3e2e98a09906fae1a03783b54b10 (diff) |
Implement a click-to-view spoiler system
Diffstat (limited to 'app/assets/javascripts/components/reducers')
-rw-r--r-- | app/assets/javascripts/components/reducers/compose.jsx | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/app/assets/javascripts/components/reducers/compose.jsx b/app/assets/javascripts/components/reducers/compose.jsx index 2df50c45b..1c6c3d4f4 100644 --- a/app/assets/javascripts/components/reducers/compose.jsx +++ b/app/assets/javascripts/components/reducers/compose.jsx @@ -17,6 +17,8 @@ import { COMPOSE_SUGGESTIONS_READY, COMPOSE_SUGGESTION_SELECT, COMPOSE_SENSITIVITY_CHANGE, + COMPOSE_SPOILERNESS_CHANGE, + COMPOSE_SPOILER_TEXT_CHANGE, COMPOSE_VISIBILITY_CHANGE, COMPOSE_LISTABILITY_CHANGE } from '../actions/compose'; @@ -27,6 +29,8 @@ import Immutable from 'immutable'; const initialState = Immutable.Map({ mounted: false, sensitive: false, + spoiler: false, + spoiler_text: '', unlisted: false, private: false, text: '', @@ -56,6 +60,8 @@ function statusToTextMentions(state, status) { function clearAll(state) { return state.withMutations(map => { map.set('text', ''); + map.set('spoiler', false); + map.set('spoiler_text', ''); map.set('is_submitting', false); map.set('in_reply_to', null); map.update('media_attachments', list => list.clear()); @@ -98,6 +104,10 @@ export default function compose(state = initialState, action) { return state.set('mounted', false); case COMPOSE_SENSITIVITY_CHANGE: return state.set('sensitive', action.checked); + case COMPOSE_SPOILERNESS_CHANGE: + return state.set('spoiler', action.checked); + case COMPOSE_SPOILER_TEXT_CHANGE: + return state.set('spoiler_text', action.text); case COMPOSE_VISIBILITY_CHANGE: return state.set('private', action.checked); case COMPOSE_LISTABILITY_CHANGE: |