Prevent replying with a more open visibility than the parent post

This commit is contained in:
FloatingGhost 2022-11-13 21:06:09 +00:00
parent 0770981a20
commit 3fa3237d76
10 changed files with 19 additions and 50 deletions

View File

@ -70,9 +70,6 @@ Default post formatting option (markdown/bbcode/plaintext/etc...)
### `redirectRootNoLogin`, `redirectRootLogin` ### `redirectRootNoLogin`, `redirectRootLogin`
These two settings should point to where FE should redirect visitor when they login/open up website root These two settings should point to where FE should redirect visitor when they login/open up website root
### `scopeCopy`
Copy post scope (visibility) when replying to a post. Instance-default.
### `sidebarRight` ### `sidebarRight`
Change alignment of sidebar and panels to the right. Defaults to `false`. Change alignment of sidebar and panels to the right. Defaults to `false`.

View File

@ -170,10 +170,8 @@ const setSettings = async ({ apiConfig, staticConfig, store }) => {
copyInstanceOption('redirectRootNoLogin') copyInstanceOption('redirectRootNoLogin')
copyInstanceOption('redirectRootLogin') copyInstanceOption('redirectRootLogin')
copyInstanceOption('showInstanceSpecificPanel') copyInstanceOption('showInstanceSpecificPanel')
copyInstanceOption('minimalScopesMode')
copyInstanceOption('hideMutedPosts') copyInstanceOption('hideMutedPosts')
copyInstanceOption('collapseMessageWithSubject') copyInstanceOption('collapseMessageWithSubject')
copyInstanceOption('scopeCopy')
copyInstanceOption('subjectLineBehavior') copyInstanceOption('subjectLineBehavior')
copyInstanceOption('postContentType') copyInstanceOption('postContentType')
copyInstanceOption('alwaysShowSubjectInput') copyInstanceOption('alwaysShowSubjectInput')

View File

@ -4,7 +4,6 @@ const FeaturesPanel = {
computed: { computed: {
whoToFollow: function () { return this.$store.state.instance.suggestionsEnabled }, whoToFollow: function () { return this.$store.state.instance.suggestionsEnabled },
mediaProxy: function () { return this.$store.state.instance.mediaProxyAvailable }, mediaProxy: function () { return this.$store.state.instance.mediaProxyAvailable },
minimalScopesMode: function () { return this.$store.state.instance.minimalScopesMode },
textlimit: function () { return this.$store.state.instance.textlimit }, textlimit: function () { return this.$store.state.instance.textlimit },
uploadlimit: function () { return fileSizeFormatService.fileSizeFormat(this.$store.state.instance.uploadlimit) } uploadlimit: function () { return fileSizeFormatService.fileSizeFormat(this.$store.state.instance.uploadlimit) }
} }

View File

@ -181,9 +181,6 @@ const PostStatusForm = {
userDefaultScope () { userDefaultScope () {
return this.$store.state.users.currentUser.default_scope return this.$store.state.users.currentUser.default_scope
}, },
showAllScopes () {
return !this.mergedConfig.minimalScopesMode
},
emojiUserSuggestor () { emojiUserSuggestor () {
return suggestor({ return suggestor({
emoji: [ emoji: [
@ -225,9 +222,6 @@ const PostStatusForm = {
isOverLengthLimit () { isOverLengthLimit () {
return this.hasStatusLengthLimit && (this.charactersLeft < 0) return this.hasStatusLengthLimit && (this.charactersLeft < 0)
}, },
minimalScopesMode () {
return this.$store.state.instance.minimalScopesMode
},
alwaysShowSubject () { alwaysShowSubject () {
return this.mergedConfig.alwaysShowSubjectInput return this.mergedConfig.alwaysShowSubjectInput
}, },
@ -647,10 +641,8 @@ const PostStatusForm = {
if (this.copyMessageScope === 'direct') { if (this.copyMessageScope === 'direct') {
return this.copyMessageScope return this.copyMessageScope
} }
if (this.$store.getters.mergedConfig.scopeCopy) { if (this.copyMessageScope !== 'public' && this.$store.state.users.currentUser.default_scope !== 'private') {
if (this.copyMessageScope !== 'public' && this.$store.state.users.currentUser.default_scope !== 'private') { return this.copyMessageScope
return this.copyMessageScope
}
} }
} }
return this.$store.state.users.currentUser.default_scope return this.$store.state.users.currentUser.default_scope

View File

@ -188,7 +188,6 @@
> >
<scope-selector <scope-selector
v-if="!disableVisibilitySelector" v-if="!disableVisibilitySelector"
:show-all="showAllScopes"
:user-default="userDefaultScope" :user-default="userDefaultScope"
:original-scope="copyMessageScope" :original-scope="copyMessageScope"
:initial-scope="newStatus.visibility" :initial-scope="newStatus.visibility"

View File

@ -13,6 +13,14 @@ library.add(
faLockOpen faLockOpen
) )
const SCOPE_LEVELS = {
'direct': 0,
'private': 1,
'local': 2,
'unlisted': 2,
'public': 3
}
const ScopeSelector = { const ScopeSelector = {
props: [ props: [
'showAll', 'showAll',
@ -57,11 +65,15 @@ const ScopeSelector = {
}, },
methods: { methods: {
shouldShow (scope) { shouldShow (scope) {
return this.showAll || if (!this.originalScope) {
this.currentScope === scope || return true
this.originalScope === scope || }
this.userDefault === scope ||
scope === 'direct' if (this.originalScope === 'local') {
return scope === 'direct' || scope === 'local'
}
return SCOPE_LEVELS[scope] <= SCOPE_LEVELS[this.originalScope]
}, },
changeVis (scope) { changeVis (scope) {
this.currentScope = scope this.currentScope = scope

View File

@ -537,18 +537,12 @@
{{ $t('settings.default_vis') }} <ServerSideIndicator :server-side="true" /> {{ $t('settings.default_vis') }} <ServerSideIndicator :server-side="true" />
<ScopeSelector <ScopeSelector
class="scope-selector" class="scope-selector"
:show-all="true"
:user-default="serverSide_defaultScope" :user-default="serverSide_defaultScope"
:initial-scope="serverSide_defaultScope" :initial-scope="serverSide_defaultScope"
:on-scope-change="changeDefaultScope" :on-scope-change="changeDefaultScope"
/> />
</label> </label>
</li> </li>
<li>
<BooleanSetting path="minimalScopesMode">
{{ $t('settings.minimal_scopes_mode') }}
</BooleanSetting>
</li>
<li> <li>
<BooleanSetting path="sensitiveByDefault"> <BooleanSetting path="sensitiveByDefault">
{{ $t('settings.sensitive_by_default') }} {{ $t('settings.sensitive_by_default') }}
@ -559,14 +553,6 @@
{{ $t('settings.sensitive_if_subject') }} {{ $t('settings.sensitive_if_subject') }}
</BooleanSetting> </BooleanSetting>
</li> </li>
<li>
<BooleanSetting
path="scopeCopy"
expert="1"
>
{{ $t('settings.scope_copy') }}
</BooleanSetting>
</li>
<li> <li>
<BooleanSetting <BooleanSetting
path="alwaysShowSubjectInput" path="alwaysShowSubjectInput"
@ -594,14 +580,6 @@
{{ $t('settings.post_status_content_type') }} {{ $t('settings.post_status_content_type') }}
</ChoiceSetting> </ChoiceSetting>
</li> </li>
<li>
<BooleanSetting
path="minimalScopesMode"
expert="1"
>
{{ $t('settings.minimal_scopes_mode') }}
</BooleanSetting>
</li>
<li> <li>
<BooleanSetting <BooleanSetting
path="alwaysShowNewPostButton" path="alwaysShowNewPostButton"

View File

@ -76,11 +76,9 @@ export const defaultState = {
hideScopeNotice: false, hideScopeNotice: false,
useStreamingApi: false, useStreamingApi: false,
sidebarRight: undefined, // instance default sidebarRight: undefined, // instance default
scopeCopy: undefined, // instance default
subjectLineBehavior: undefined, // instance default subjectLineBehavior: undefined, // instance default
alwaysShowSubjectInput: undefined, // instance default alwaysShowSubjectInput: undefined, // instance default
postContentType: undefined, // instance default postContentType: undefined, // instance default
minimalScopesMode: undefined, // instance default
// This hides statuses filtered via a word filter // This hides statuses filtered via a word filter
hideFilteredStatuses: undefined, // instance default hideFilteredStatuses: undefined, // instance default
modalOnRepeat: undefined, // instance default modalOnRepeat: undefined, // instance default

View File

@ -53,12 +53,10 @@ const defaultState = {
logoMargin: '.2em', logoMargin: '.2em',
logoMask: true, logoMask: true,
logoLeft: false, logoLeft: false,
minimalScopesMode: false,
nsfwCensorImage: undefined, nsfwCensorImage: undefined,
postContentType: 'text/plain', postContentType: 'text/plain',
redirectRootLogin: '/main/friends', redirectRootLogin: '/main/friends',
redirectRootNoLogin: '/main/all', redirectRootNoLogin: '/main/all',
scopeCopy: true,
showFeaturesPanel: true, showFeaturesPanel: true,
showInstanceSpecificPanel: false, showInstanceSpecificPanel: false,
showNavShortcuts: true, showNavShortcuts: true,

View File

@ -13,12 +13,10 @@
"logoMargin": ".1em", "logoMargin": ".1em",
"logoMask": true, "logoMask": true,
"logoLeft": false, "logoLeft": false,
"minimalScopesMode": false,
"nsfwCensorImage": "", "nsfwCensorImage": "",
"postContentType": "text/plain", "postContentType": "text/plain",
"redirectRootLogin": "/main/friends", "redirectRootLogin": "/main/friends",
"redirectRootNoLogin": "/main/all", "redirectRootNoLogin": "/main/all",
"scopeCopy": true,
"showFeaturesPanel": true, "showFeaturesPanel": true,
"showInstanceSpecificPanel": false, "showInstanceSpecificPanel": false,
"sidebarRight": false, "sidebarRight": false,