Merge branch 'deafult-privacy' into 'develop'
Fix default privacy setting on Mastodon See merge request soapbox-pub/soapbox!2470
This commit is contained in:
commit
e5cf1dfa85
1 changed files with 2 additions and 15 deletions
|
@ -245,25 +245,13 @@ const getAccountSettings = (account: ImmutableMap<string, any>) => {
|
|||
const importAccount = (compose: Compose, account: APIEntity) => {
|
||||
const settings = getAccountSettings(ImmutableMap(fromJS(account)));
|
||||
|
||||
const defaultPrivacy = settings.get('defaultPrivacy', 'public');
|
||||
const defaultContentType = settings.get('defaultContentType', 'text/plain');
|
||||
|
||||
return compose.merge({
|
||||
privacy: defaultPrivacy,
|
||||
content_type: defaultContentType,
|
||||
tagHistory: ImmutableList(tagHistory.get(account.id)),
|
||||
});
|
||||
};
|
||||
|
||||
const updateAccount = (compose: Compose, account: APIEntity) => {
|
||||
const settings = getAccountSettings(ImmutableMap(fromJS(account)));
|
||||
|
||||
const defaultPrivacy = settings.get('defaultPrivacy');
|
||||
const defaultContentType = settings.get('defaultContentType');
|
||||
|
||||
return compose.withMutations(compose => {
|
||||
if (defaultPrivacy) compose.set('privacy', defaultPrivacy);
|
||||
if (defaultContentType) compose.set('content_type', defaultContentType);
|
||||
compose.set('tagHistory', ImmutableList(tagHistory.get(account.id)));
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -507,9 +495,8 @@ export default function compose(state = initialState, action: AnyAction) {
|
|||
case COMPOSE_SET_GROUP_TIMELINE_VISIBLE:
|
||||
return updateCompose(state, action.id, compose => compose.set('group_timeline_visible', action.groupTimelineVisible));
|
||||
case ME_FETCH_SUCCESS:
|
||||
return updateCompose(state, 'default', compose => importAccount(compose, action.me));
|
||||
case ME_PATCH_SUCCESS:
|
||||
return updateCompose(state, 'default', compose => updateAccount(compose, action.me));
|
||||
return updateCompose(state, 'default', compose => importAccount(compose, action.me));
|
||||
case SETTING_CHANGE:
|
||||
return updateCompose(state, 'default', compose => updateSetting(compose, action.path, action.value));
|
||||
default:
|
||||
|
|
Loading…
Reference in a new issue