Add enable local public visibility setting for admin

This commit is contained in:
KMY 2023-09-23 09:18:50 +09:00
parent 454008e432
commit 8eae7e6179
15 changed files with 35 additions and 7 deletions

View file

@ -9,7 +9,7 @@ import { supportsPassiveEvents } from 'detect-passive-events';
import Overlay from 'react-overlays/Overlay';
import { Icon } from 'mastodon/components/icon';
import { enableLoginPrivacy } from 'mastodon/initial_state';
import { enableLoginPrivacy, enableLocalPrivacy } from 'mastodon/initial_state';
import { IconButton } from '../../../components/icon_button';
@ -246,6 +246,10 @@ class PrivacyDropdown extends PureComponent {
this.selectableOptions = this.selectableOptions.filter((opt) => opt.value !== 'login');
}
if (!enableLocalPrivacy) {
this.selectableOptions = this.selectableOptions.filter((opt) => opt.value !== 'public_unlisted');
}
if (this.props.noDirect) {
this.selectableOptions = this.selectableOptions.filter((opt) => opt.value !== 'direct');
}

View file

@ -61,6 +61,7 @@
* @property {string} dtl_tag
* @property {boolean} enable_emoji_reaction
* @property {boolean} enable_login_privacy
* @property {boolean} enable_local_privacy
* @property {boolean} enable_dtl_menu
* @property {boolean=} expand_spoilers
* @property {boolean} hide_recent_emojis
@ -130,6 +131,7 @@ export const displayMediaExpand = getMeta('display_media_expand');
export const domain = getMeta('domain');
export const dtlTag = getMeta('dtl_tag');
export const enableEmojiReaction = getMeta('enable_emoji_reaction');
export const enableLocalPrivacy = getMeta('enable_local_privacy');
export const enableLoginPrivacy = getMeta('enable_login_privacy');
export const enableDtlMenu = getMeta('enable_dtl_menu');
export const expandSpoilers = getMeta('expand_spoilers');

View file

@ -58,7 +58,7 @@ import {
import { REDRAFT } from '../actions/statuses';
import { STORE_HYDRATE } from '../actions/store';
import { TIMELINE_DELETE } from '../actions/timelines';
import { me } from '../initial_state';
import { enableLocalPrivacy, me } from '../initial_state';
import { unescapeHTML } from '../utils/html';
import { uuid } from '../uuid';
@ -138,6 +138,9 @@ function clearAll(state) {
if (state.get('stay_privacy') && !state.get('in_reply_to')) {
map.set('default_privacy', state.get('privacy'));
}
if (map.get('privacy') && !enableLocalPrivacy) {
map.set('privacy', 'public');
}
if (!state.get('in_reply_to')) {
map.set('posted_on_this_session', true);
}