diff --git a/app/gabsocial/features/preferences/index.js b/app/gabsocial/features/preferences/index.js index 023c6a898..293da6e1a 100644 --- a/app/gabsocial/features/preferences/index.js +++ b/app/gabsocial/features/preferences/index.js @@ -53,36 +53,66 @@ class Preferences extends ImmutablePureComponent { dispatch(changeSetting(['theme'], e.target.value)); } + onDefaultPrivacyChange = e => { + const { dispatch } = this.props; + dispatch(changeSetting(['defaultPrivacy'], e.target.value)); + } + render() { const { settings, intl } = this.props; return (
-
-
-
-
- -
- -
+
+
+
+ +
+
-
+ +
+
+
+ +
    +
  • + +
  • +
  • + +
  • +
  • + +
  • +
+
+
+
); diff --git a/app/gabsocial/reducers/compose.js b/app/gabsocial/reducers/compose.js index 4bc327192..930909a3b 100644 --- a/app/gabsocial/reducers/compose.js +++ b/app/gabsocial/reducers/compose.js @@ -39,6 +39,8 @@ import { import { TIMELINE_DELETE } from '../actions/timelines'; import { STORE_HYDRATE } from '../actions/store'; import { REDRAFT } from '../actions/statuses'; +import { ME_FETCH_SUCCESS } from '../actions/me'; +import { SETTING_CHANGE, FE_NAME } from '../actions/settings'; import { Map as ImmutableMap, List as ImmutableList, OrderedSet as ImmutableOrderedSet, fromJS } from 'immutable'; import uuid from '../uuid'; import { unescapeHTML } from '../utils/html'; @@ -368,6 +370,16 @@ export default function compose(state = initialState, action) { return state.updateIn(['poll', 'options'], options => options.delete(action.index)); case COMPOSE_POLL_SETTINGS_CHANGE: return state.update('poll', poll => poll.set('expires_in', action.expiresIn).set('multiple', action.isMultiple)); + case ME_FETCH_SUCCESS: + const me = fromJS(action.me); + const defaultPrivacy = me.getIn(['pleroma', 'settings_store', FE_NAME, 'defaultPrivacy']); + if (!defaultPrivacy) return state; + return state.set('default_privacy', defaultPrivacy).set('privacy', defaultPrivacy); + case SETTING_CHANGE: + const pathString = action.path.join(','); + if (pathString === 'defaultPrivacy') + return state.set('default_privacy', action.value).set('privacy', action.value); + return state; default: return state; } diff --git a/app/gabsocial/reducers/settings.js b/app/gabsocial/reducers/settings.js index 24dab6301..c3b30481a 100644 --- a/app/gabsocial/reducers/settings.js +++ b/app/gabsocial/reducers/settings.js @@ -19,6 +19,7 @@ const initialState = ImmutableMap({ unfollowModal: false, boostModal: false, deleteModal: true, + defaultPrivacy: 'public', theme: 'lime', home: ImmutableMap({