about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/reducers/compose.js
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2019-05-17 10:52:27 +0200
committerThibG <thib@sitedethib.com>2019-05-17 23:51:14 +0200
commit56245a2a7204bb63840e633e923bfd1679c793d9 (patch)
tree40ea4e3088619b9c87ef7310825872582f8e75a4 /app/javascript/flavours/glitch/reducers/compose.js
parentdd5bf40b97d42daae855cd05ac13c6efa6cda4f6 (diff)
Export fallback content type and use it as default in WebUI
Diffstat (limited to 'app/javascript/flavours/glitch/reducers/compose.js')
-rw-r--r--app/javascript/flavours/glitch/reducers/compose.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/app/javascript/flavours/glitch/reducers/compose.js b/app/javascript/flavours/glitch/reducers/compose.js
index 82facb1e2..c0c2fc547 100644
--- a/app/javascript/flavours/glitch/reducers/compose.js
+++ b/app/javascript/flavours/glitch/reducers/compose.js
@@ -45,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';
@@ -67,7 +67,7 @@ const initialState = ImmutableMap({
   spoiler: false,
   spoiler_text: '',
   privacy: null,
-  content_type: 'text/plain',
+  content_type: defaultContentType || 'text/plain',
   text: '',
   focusDate: null,
   caretPosition: null,
@@ -143,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);
@@ -354,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', '');