diff --git a/app/soapbox/actions/settings.js b/app/soapbox/actions/settings.js
index 03b538bcc..9bace7d7e 100644
--- a/app/soapbox/actions/settings.js
+++ b/app/soapbox/actions/settings.js
@@ -21,6 +21,7 @@ export const defaultSettings = ImmutableMap({
boostModal: false,
deleteModal: true,
defaultPrivacy: 'public',
+ defaultContentType: 'text/plain',
themeMode: 'light',
locale: navigator.language.split(/[-_]/)[0] || 'en',
explanationBox: true,
diff --git a/app/soapbox/features/preferences/index.js b/app/soapbox/features/preferences/index.js
index f42577674..b5360808d 100644
--- a/app/soapbox/features/preferences/index.js
+++ b/app/soapbox/features/preferences/index.js
@@ -4,7 +4,7 @@ import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
import ImmutablePureComponent from 'react-immutable-pure-component';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
-import { changeSetting } from 'soapbox/actions/settings';
+import { getSettings, changeSetting } from 'soapbox/actions/settings';
import Column from '../ui/components/column';
import {
SimpleForm,
@@ -85,7 +85,7 @@ const messages = defineMessages({
});
const mapStateToProps = state => ({
- settings: state.get('settings'),
+ settings: getSettings(state),
});
export default @connect(mapStateToProps)
@@ -109,6 +109,11 @@ class Preferences extends ImmutablePureComponent {
dispatch(changeSetting(['defaultPrivacy'], e.target.value));
}
+ onDefaultContentTypeChange = e => {
+ const { dispatch } = this.props;
+ dispatch(changeSetting(['defaultContentType'], e.target.value));
+ }
+
render() {
const { settings, intl } = this.props;
@@ -165,6 +170,24 @@ class Preferences extends ImmutablePureComponent {
+
+ }
+ onChange={this.onDefaultContentTypeChange}
+ >
+ }
+ checked={settings.get('defaultContentType') === 'text/plain'}
+ value='text/plain'
+ />
+ }
+ checked={settings.get('defaultContentType') === 'text/markdown'}
+ value='text/markdown'
+ />
+
+
+
}
diff --git a/app/soapbox/reducers/__tests__/compose-test.js b/app/soapbox/reducers/__tests__/compose-test.js
index d8122bab2..a3b1781e4 100644
--- a/app/soapbox/reducers/__tests__/compose-test.js
+++ b/app/soapbox/reducers/__tests__/compose-test.js
@@ -31,7 +31,7 @@ describe('compose reducer', () => {
default_privacy: 'public',
default_sensitive: false,
tagHistory: [],
- content_type: 'text/markdown',
+ content_type: 'text/plain',
});
expect(state.get('idempotencyKey').length === 36);
});
diff --git a/app/soapbox/reducers/compose.js b/app/soapbox/reducers/compose.js
index c72ea6d87..055535d41 100644
--- a/app/soapbox/reducers/compose.js
+++ b/app/soapbox/reducers/compose.js
@@ -52,7 +52,7 @@ const initialState = ImmutableMap({
sensitive: false,
spoiler: false,
spoiler_text: '',
- content_type: 'text/markdown',
+ content_type: 'text/plain',
privacy: 'public',
text: '',
focusDate: null,
@@ -69,6 +69,7 @@ const initialState = ImmutableMap({
suggestions: ImmutableList(),
default_privacy: 'public',
default_sensitive: false,
+ default_content_type: 'text/plain',
resetFileKey: Math.floor((Math.random() * 0x10000)),
idempotencyKey: uuid(),
tagHistory: ImmutableList(),
@@ -97,7 +98,7 @@ function clearAll(state) {
map.set('text', '');
map.set('spoiler', false);
map.set('spoiler_text', '');
- map.set('content_type', 'text/markdown');
+ map.set('content_type', state.get('default_content_type'));
map.set('is_submitting', false);
map.set('is_changing_upload', false);
map.set('in_reply_to', null);
@@ -193,7 +194,7 @@ const expandMentions = status => {
};
export default function compose(state = initialState, action) {
- let me, defaultPrivacy;
+ let me, defaultPrivacy, defaultContentType;
switch(action.type) {
case COMPOSE_MOUNT:
return state.set('mounted', state.get('mounted') + 1);
@@ -246,7 +247,7 @@ export default function compose(state = initialState, action) {
map.set('focusDate', new Date());
map.set('caretPosition', null);
map.set('idempotencyKey', uuid());
- map.set('content_type', 'text/markdown');
+ map.set('content_type', state.get('default_content_type'));
if (action.status.get('spoiler_text', '').length > 0) {
map.set('spoiler', true);
@@ -331,7 +332,7 @@ export default function compose(state = initialState, action) {
map.set('focusDate', new Date());
map.set('caretPosition', null);
map.set('idempotencyKey', uuid());
- map.set('content_type', 'text/markdown');
+ map.set('content_type', action.status.get('content_type'));
if (action.status.get('spoiler_text').length > 0) {
map.set('spoiler', true);
@@ -364,21 +365,31 @@ export default function compose(state = initialState, action) {
case ME_FETCH_SUCCESS:
me = fromJS(action.me);
defaultPrivacy = me.getIn(['pleroma', 'settings_store', FE_NAME, 'defaultPrivacy'], 'public');
+ defaultContentType = me.getIn(['pleroma', 'settings_store', FE_NAME, 'defaultContentType'], 'text/plain');
return state.merge({
default_privacy: defaultPrivacy,
privacy: defaultPrivacy,
+ default_content_type: defaultContentType,
+ content_type: defaultContentType,
tagHistory: ImmutableList(tagHistory.get(action.me.id)),
});
case ME_PATCH_SUCCESS:
me = fromJS(action.me);
defaultPrivacy = me.getIn(['pleroma', 'settings_store', FE_NAME, 'defaultPrivacy']);
- if (!defaultPrivacy) return state;
- return state.set('default_privacy', defaultPrivacy);
+ defaultContentType = me.getIn(['pleroma', 'settings_store', FE_NAME, 'defaultContentType']);
+ if (defaultPrivacy) state = state.set('default_privacy', defaultPrivacy);
+ if (defaultContentType) state = state.set('default_content_type', defaultContentType);
+ return state;
case SETTING_CHANGE:
const pathString = action.path.join(',');
- if (pathString === 'defaultPrivacy')
+ switch (pathString) {
+ case 'defaultPrivacy':
return state.set('default_privacy', action.value).set('privacy', action.value);
- return state;
+ case 'defaultContentType':
+ return state.set('default_content_type', action.value).set('content_type', action.value);
+ default:
+ return state;
+ }
default:
return state;
}