Let default post privacy be configurable
This commit is contained in:
parent
16d65f88f1
commit
e761942ced
|
@ -53,13 +53,17 @@ class Preferences extends ImmutablePureComponent {
|
||||||
dispatch(changeSetting(['theme'], e.target.value));
|
dispatch(changeSetting(['theme'], e.target.value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onDefaultPrivacyChange = e => {
|
||||||
|
const { dispatch } = this.props;
|
||||||
|
dispatch(changeSetting(['defaultPrivacy'], e.target.value));
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { settings, intl } = this.props;
|
const { settings, intl } = this.props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Column icon='users' heading={intl.formatMessage(messages.heading)} backBtnSlim>
|
<Column icon='users' heading={intl.formatMessage(messages.heading)} backBtnSlim>
|
||||||
<form className='simple_form' onSubmit={this.handleSubmit}>
|
<form className='simple_form' onSubmit={this.handleSubmit}>
|
||||||
<fieldset disabled={this.state.isLoading}>
|
|
||||||
<div className='fields-group'>
|
<div className='fields-group'>
|
||||||
<div className='input with_label select optional user_setting_theme'>
|
<div className='input with_label select optional user_setting_theme'>
|
||||||
<div className='label_input'>
|
<div className='label_input'>
|
||||||
|
@ -82,7 +86,33 @@ class Preferences extends ImmutablePureComponent {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
<div className='fields-group'>
|
||||||
|
<div className='input with_floating_label radio_buttons optional user_setting_default_privacy'>
|
||||||
|
<div className='label_input'>
|
||||||
|
<label className='radio_buttons optional'>Post privacy</label>
|
||||||
|
<ul>
|
||||||
|
<li className='radio'>
|
||||||
|
<label htmlFor='user_setting_default_privacy_public'>
|
||||||
|
<input className='radio_buttons optional' type='radio' checked={settings.get('defaultPrivacy') === 'public'} onChange={this.onDefaultPrivacyChange} value='public' id='user_setting_default_privacy_public' />Public
|
||||||
|
<span className='hint'>Everyone can see</span>
|
||||||
|
</label>
|
||||||
|
</li>
|
||||||
|
<li className='radio'>
|
||||||
|
<label htmlFor='user_setting_default_privacy_unlisted'>
|
||||||
|
<input className='radio_buttons optional' type='radio' checked={settings.get('defaultPrivacy') === 'unlisted'} onChange={this.onDefaultPrivacyChange} value='unlisted' id='user_setting_default_privacy_unlisted' />Unlisted
|
||||||
|
<span className='hint'>Everyone can see, but not listed on public timelines</span>
|
||||||
|
</label>
|
||||||
|
</li>
|
||||||
|
<li className='radio'>
|
||||||
|
<label htmlFor='user_setting_default_privacy_private'>
|
||||||
|
<input className='radio_buttons optional' type='radio' checked={settings.get('defaultPrivacy') === 'private'} onChange={this.onDefaultPrivacyChange} value='private' id='user_setting_default_privacy_private' />Followers-only
|
||||||
|
<span className='hint'>Only show to followers</span>
|
||||||
|
</label>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</Column>
|
</Column>
|
||||||
);
|
);
|
||||||
|
|
|
@ -39,6 +39,8 @@ import {
|
||||||
import { TIMELINE_DELETE } from '../actions/timelines';
|
import { TIMELINE_DELETE } from '../actions/timelines';
|
||||||
import { STORE_HYDRATE } from '../actions/store';
|
import { STORE_HYDRATE } from '../actions/store';
|
||||||
import { REDRAFT } from '../actions/statuses';
|
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 { Map as ImmutableMap, List as ImmutableList, OrderedSet as ImmutableOrderedSet, fromJS } from 'immutable';
|
||||||
import uuid from '../uuid';
|
import uuid from '../uuid';
|
||||||
import { unescapeHTML } from '../utils/html';
|
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));
|
return state.updateIn(['poll', 'options'], options => options.delete(action.index));
|
||||||
case COMPOSE_POLL_SETTINGS_CHANGE:
|
case COMPOSE_POLL_SETTINGS_CHANGE:
|
||||||
return state.update('poll', poll => poll.set('expires_in', action.expiresIn).set('multiple', action.isMultiple));
|
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:
|
default:
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@ const initialState = ImmutableMap({
|
||||||
unfollowModal: false,
|
unfollowModal: false,
|
||||||
boostModal: false,
|
boostModal: false,
|
||||||
deleteModal: true,
|
deleteModal: true,
|
||||||
|
defaultPrivacy: 'public',
|
||||||
theme: 'lime',
|
theme: 'lime',
|
||||||
|
|
||||||
home: ImmutableMap({
|
home: ImmutableMap({
|
||||||
|
|
Loading…
Reference in New Issue