diff options
author | Reverite <github@reverite.sh> | 2019-05-21 20:48:57 -0700 |
---|---|---|
committer | Reverite <github@reverite.sh> | 2019-05-21 20:48:57 -0700 |
commit | d873e4f3d5878a2b2800758cbe3b9c870c228d51 (patch) | |
tree | 23a3a373699381d4bd4f629136b9c82de5df96a3 /app/javascript/flavours/glitch/reducers | |
parent | 4cea89bf2e9ce7f73fccfc637191b1e039ad25ee (diff) | |
parent | 2332b3f146b0d879daba8a99bd35c8bf425edea3 (diff) |
Merge branch 'glitch' into production
Diffstat (limited to 'app/javascript/flavours/glitch/reducers')
-rw-r--r-- | app/javascript/flavours/glitch/reducers/compose.js | 11 | ||||
-rw-r--r-- | app/javascript/flavours/glitch/reducers/local_settings.js | 1 |
2 files changed, 11 insertions, 1 deletions
diff --git a/app/javascript/flavours/glitch/reducers/compose.js b/app/javascript/flavours/glitch/reducers/compose.js index bc1785a48..c0c2fc547 100644 --- a/app/javascript/flavours/glitch/reducers/compose.js +++ b/app/javascript/flavours/glitch/reducers/compose.js @@ -25,6 +25,7 @@ import { COMPOSE_SPOILERNESS_CHANGE, COMPOSE_SPOILER_TEXT_CHANGE, COMPOSE_VISIBILITY_CHANGE, + COMPOSE_CONTENT_TYPE_CHANGE, COMPOSE_EMOJI_INSERT, COMPOSE_UPLOAD_CHANGE_REQUEST, COMPOSE_UPLOAD_CHANGE_SUCCESS, @@ -44,7 +45,7 @@ import { REDRAFT } from 'flavours/glitch/actions/statuses'; import { Map as ImmutableMap, List as ImmutableList, OrderedSet as ImmutableOrderedSet, fromJS } from 'immutable'; import uuid from 'flavours/glitch/util/uuid'; import { privacyPreference } from 'flavours/glitch/util/privacy_preference'; -import { me } from 'flavours/glitch/util/initial_state'; +import { me, defaultContentType } from 'flavours/glitch/util/initial_state'; import { overwrite } from 'flavours/glitch/util/js_helpers'; import { unescapeHTML } from 'flavours/glitch/util/html'; import { recoverHashtags } from 'flavours/glitch/util/hashtag'; @@ -66,6 +67,7 @@ const initialState = ImmutableMap({ spoiler: false, spoiler_text: '', privacy: null, + content_type: defaultContentType || 'text/plain', text: '', focusDate: null, caretPosition: null, @@ -141,6 +143,7 @@ function apiStatusToTextHashtags (state, status) { function clearAll(state) { return state.withMutations(map => { map.set('text', ''); + if (defaultContentType) map.set('content_type', defaultContentType); map.set('spoiler', false); map.set('spoiler_text', ''); map.set('is_submitting', false); @@ -310,6 +313,10 @@ export default function compose(state = initialState, action) { return state .set('privacy', action.value) .set('idempotencyKey', uuid()); + case COMPOSE_CONTENT_TYPE_CHANGE: + return state + .set('content_type', action.value) + .set('idempotencyKey', uuid()); case COMPOSE_CHANGE: return state .set('text', action.text) @@ -348,6 +355,7 @@ export default function compose(state = initialState, action) { case COMPOSE_RESET: return state.withMutations(map => { map.set('in_reply_to', null); + if (defaultContentType) map.set('content_type', defaultContentType); map.set('text', ''); map.set('spoiler', false); map.set('spoiler_text', ''); @@ -427,6 +435,7 @@ export default function compose(state = initialState, action) { case REDRAFT: return state.withMutations(map => { map.set('text', action.raw_text || unescapeHTML(expandMentions(action.status))); + map.set('content_type', action.content_type || 'text/plain'); map.set('in_reply_to', action.status.get('in_reply_to_id')); map.set('privacy', action.status.get('visibility')); map.set('media_attachments', action.status.get('media_attachments')); diff --git a/app/javascript/flavours/glitch/reducers/local_settings.js b/app/javascript/flavours/glitch/reducers/local_settings.js index 8dea4d8f6..5716c5982 100644 --- a/app/javascript/flavours/glitch/reducers/local_settings.js +++ b/app/javascript/flavours/glitch/reducers/local_settings.js @@ -19,6 +19,7 @@ const initialState = ImmutableMap({ preselect_on_reply: true, inline_preview_cards: true, hicolor_privacy_icons: false, + show_content_type_choice: false, content_warnings : ImmutableMap({ auto_unfold : false, filter : null, |