Initial work on deprecating scopeModesEnabled in favor of minimalScopeMode

This commit is contained in:
Henry Jameson 2019-03-03 15:15:41 +02:00
parent cef0306428
commit 6184c88ac7
15 changed files with 149 additions and 31 deletions

View File

@ -78,7 +78,7 @@ const afterStoreSetup = ({ store, i18n }) => {
copyInstanceOption('redirectRootNoLogin') copyInstanceOption('redirectRootNoLogin')
copyInstanceOption('redirectRootLogin') copyInstanceOption('redirectRootLogin')
copyInstanceOption('showInstanceSpecificPanel') copyInstanceOption('showInstanceSpecificPanel')
copyInstanceOption('scopeOptionsEnabled') copyInstanceOption('minimalScopesMode')
copyInstanceOption('formattingOptionsEnabled') copyInstanceOption('formattingOptionsEnabled')
copyInstanceOption('collapseMessageWithSubject') copyInstanceOption('collapseMessageWithSubject')
copyInstanceOption('loginMethod') copyInstanceOption('loginMethod')

View File

@ -6,7 +6,7 @@ const FeaturesPanel = {
gopher: function () { return this.$store.state.instance.gopherAvailable }, gopher: function () { return this.$store.state.instance.gopherAvailable },
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 },
scopeOptions: function () { return this.$store.state.instance.scopeOptionsEnabled }, scopeOptionsMinimal: function () { return this.$store.state.instance.scopeOptionsMinimal },
textlimit: function () { return this.$store.state.instance.textlimit } textlimit: function () { return this.$store.state.instance.textlimit }
} }
} }

View File

@ -1,5 +1,6 @@
import statusPoster from '../../services/status_poster/status_poster.service.js' import statusPoster from '../../services/status_poster/status_poster.service.js'
import MediaUpload from '../media_upload/media_upload.vue' import MediaUpload from '../media_upload/media_upload.vue'
import ScopeSelector from '../scope_selector/scope_selector.vue'
import fileTypeService from '../../services/file_type/file_type.service.js' import fileTypeService from '../../services/file_type/file_type.service.js'
import Completion from '../../services/completion/completion.js' import Completion from '../../services/completion/completion.js'
import { take, filter, reject, map, uniqBy } from 'lodash' import { take, filter, reject, map, uniqBy } from 'lodash'
@ -28,7 +29,8 @@ const PostStatusForm = {
'subject' 'subject'
], ],
components: { components: {
MediaUpload MediaUpload,
ScopeSelector
}, },
mounted () { mounted () {
this.resize(this.$refs.textarea) this.resize(this.$refs.textarea)
@ -78,14 +80,6 @@ const PostStatusForm = {
} }
}, },
computed: { computed: {
vis () {
return {
public: { selected: this.newStatus.visibility === 'public' },
unlisted: { selected: this.newStatus.visibility === 'unlisted' },
private: { selected: this.newStatus.visibility === 'private' },
direct: { selected: this.newStatus.visibility === 'direct' }
}
},
candidates () { candidates () {
const firstchar = this.textAtCaret.charAt(0) const firstchar = this.textAtCaret.charAt(0)
if (firstchar === '@') { if (firstchar === '@') {
@ -133,6 +127,15 @@ const PostStatusForm = {
users () { users () {
return this.$store.state.users.users return this.$store.state.users.users
}, },
userDefaultScope () {
return this.$store.state.users.currentUser.default_scope
},
showAllScopes () {
const minimalScopesMode = typeof this.$store.state.config.minimalScopesMode === 'undefined'
? this.$store.state.instance.minimalScopesMode
: this.$store.state.config.minimalScopesMode
return !minimalScopesMode
},
emoji () { emoji () {
return this.$store.state.instance.emoji || [] return this.$store.state.instance.emoji || []
}, },
@ -157,8 +160,8 @@ const PostStatusForm = {
isOverLengthLimit () { isOverLengthLimit () {
return this.hasStatusLengthLimit && (this.charactersLeft < 0) return this.hasStatusLengthLimit && (this.charactersLeft < 0)
}, },
scopeOptionsEnabled () { scopeOptionsMinimal () {
return this.$store.state.instance.scopeOptionsEnabled return this.$store.state.instance.scopeOptionsMinimal
}, },
alwaysShowSubject () { alwaysShowSubject () {
if (typeof this.$store.state.config.alwaysShowSubjectInput !== 'undefined') { if (typeof this.$store.state.config.alwaysShowSubjectInput !== 'undefined') {
@ -166,7 +169,7 @@ const PostStatusForm = {
} else if (typeof this.$store.state.instance.alwaysShowSubjectInput !== 'undefined') { } else if (typeof this.$store.state.instance.alwaysShowSubjectInput !== 'undefined') {
return this.$store.state.instance.alwaysShowSubjectInput return this.$store.state.instance.alwaysShowSubjectInput
} else { } else {
return this.$store.state.instance.scopeOptionsEnabled return true
} }
}, },
formattingOptionsEnabled () { formattingOptionsEnabled () {

View File

@ -44,12 +44,13 @@
</label> </label>
</span> </span>
<div v-if="scopeOptionsEnabled"> <scope-selector
<i v-on:click="changeVis('direct')" class="icon-mail-alt" :class="vis.direct" :title="$t('post_status.scope.direct')"></i> :showAll="showAllScopes"
<i v-on:click="changeVis('private')" class="icon-lock" :class="vis.private" :title="$t('post_status.scope.private')"></i> :userEnabled="['direct']"
<i v-on:click="changeVis('unlisted')" class="icon-lock-open-alt" :class="vis.unlisted" :title="$t('post_status.scope.unlisted')"></i> :userDefault="userDefaultScope"
<i v-on:click="changeVis('public')" class="icon-globe" :class="vis.public" :title="$t('post_status.scope.public')"></i> :originalScope="copyMessageScope"
</div> :initialScope="newStatus.visibility"
:onScopeChange="changeVis"/>
</div> </div>
</div> </div>
<div style="position:relative;" v-if="candidates"> <div style="position:relative;" v-if="candidates">

View File

@ -0,0 +1,55 @@
const ScopeSelector = {
props: [
'showAll',
'userEnabled',
'userDefault',
'originalScope',
'initialScope',
'onScopeChange'
],
data () {
return {
currentScope: this.initialScope
}
},
computed: {
showNothing () {
return !this.showPublic && !this.showUnlisted && !this.showPrivate && !this.showDirect
},
showPublic () {
return this.originalScope !== 'direct' && this.shouldShow('public')
},
showUnlisted () {
return this.originalScope !== 'direct' && this.shouldShow('unlisted')
},
showPrivate () {
return this.originalScope !== 'direct' && this.shouldShow('private')
},
showDirect () {
return this.shouldShow('direct')
},
css () {
return {
public: {selected: this.currentScope === 'public'},
unlisted: {selected: this.currentScope === 'unlisted'},
private: {selected: this.currentScope === 'private'},
direct: {selected: this.currentScope === 'direct'}
}
}
},
methods: {
shouldShow (scope) {
return this.showAll ||
this.currentScope === scope ||
this.originalScope === scope ||
this.userDefault === scope ||
this.userEnabled.includes(scope)
},
changeVis (scope) {
this.currentScope = scope
this.onScopeChange && this.onScopeChange(scope)
}
}
}
export default ScopeSelector

View File

@ -0,0 +1,30 @@
<template>
<div v-if="!showNothing">
<i class="icon-mail-alt"
:class="css.direct"
:title="$t('post_status.scope.direct')"
v-if="showDirect"
@click="changeVis('direct')">
</i>
<i class="icon-lock"
:class="css.private"
:title="$t('post_status.scope.private')"
v-if="showPrivate"
v-on:click="changeVis('private')">
</i>
<i class="icon-lock-open-alt"
:class="css.unlisted"
:title="$t('post_status.scope.unlisted')"
v-if="showUnlisted"
@click="changeVis('unlisted')">
</i>
<i class="icon-globe"
:class="css.public"
:title="$t('post_status.scope.public')"
v-if="showPublic"
@click="changeVis('public')">
</i>
</div>
</template>
<script src="./scope_selector.js"></script>

View File

@ -60,13 +60,18 @@ const settings = {
alwaysShowSubjectInputLocal: typeof user.alwaysShowSubjectInput === 'undefined' alwaysShowSubjectInputLocal: typeof user.alwaysShowSubjectInput === 'undefined'
? instance.alwaysShowSubjectInput ? instance.alwaysShowSubjectInput
: user.alwaysShowSubjectInput, : user.alwaysShowSubjectInput,
alwaysShowSubjectInputDefault: instance.alwaysShowSubjectInput, alwaysShowSubjectInputDefault: this.$t('settings.values.' + instance.alwaysShowSubjectInput),
scopeCopyLocal: typeof user.scopeCopy === 'undefined' scopeCopyLocal: typeof user.scopeCopy === 'undefined'
? instance.scopeCopy ? instance.scopeCopy
: user.scopeCopy, : user.scopeCopy,
scopeCopyDefault: this.$t('settings.values.' + instance.scopeCopy), scopeCopyDefault: this.$t('settings.values.' + instance.scopeCopy),
minimalScopesModeLocal: typeof user.minimalScopesMode === 'undefined'
? instance.minimalScopesMode
: user.minimalScopesMode,
minimalScopesModeDefault: this.$t('settings.values.' + instance.minimalScopesMode),
stopGifs: user.stopGifs, stopGifs: user.stopGifs,
webPushNotificationsLocal: user.webPushNotifications, webPushNotificationsLocal: user.webPushNotifications,
loopVideoSilentOnlyLocal: user.loopVideosSilentOnly, loopVideoSilentOnlyLocal: user.loopVideosSilentOnly,
@ -175,6 +180,9 @@ const settings = {
postContentTypeLocal (value) { postContentTypeLocal (value) {
this.$store.dispatch('setOption', { name: 'postContentType', value }) this.$store.dispatch('setOption', { name: 'postContentType', value })
}, },
minimalScopesModeLocal (value) {
this.$store.dispatch('setOption', { name: 'minimalScopesMode', value })
},
stopGifs (value) { stopGifs (value) {
this.$store.dispatch('setOption', { name: 'stopGifs', value }) this.$store.dispatch('setOption', { name: 'stopGifs', value })
}, },

View File

@ -122,6 +122,12 @@
</label> </label>
</div> </div>
</li> </li>
<li>
<input type="checkbox" id="minimalScopesMode" v-model="minimalScopesModeLocal">
<label for="minimalScopesMode">
{{$t('settings.minimal_scopes_mode')}} {{$t('settings.instance_default', { value: minimalScopesModeDefault })}}
</label>
</li>
</ul> </ul>
</div> </div>

View File

@ -4,6 +4,7 @@ import get from 'lodash/get'
import TabSwitcher from '../tab_switcher/tab_switcher.js' import TabSwitcher from '../tab_switcher/tab_switcher.js'
import ImageCropper from '../image_cropper/image_cropper.vue' import ImageCropper from '../image_cropper/image_cropper.vue'
import StyleSwitcher from '../style_switcher/style_switcher.vue' import StyleSwitcher from '../style_switcher/style_switcher.vue'
import ScopeSelector from '../scope_selector/scope_selector.vue'
import fileSizeFormatService from '../../services/file_size_format/file_size_format.js' import fileSizeFormatService from '../../services/file_size_format/file_size_format.js'
import BlockCard from '../block_card/block_card.vue' import BlockCard from '../block_card/block_card.vue'
import MuteCard from '../mute_card/mute_card.vue' import MuteCard from '../mute_card/mute_card.vue'
@ -66,6 +67,7 @@ const UserSettings = {
}, },
components: { components: {
StyleSwitcher, StyleSwitcher,
ScopeSelector,
TabSwitcher, TabSwitcher,
ImageCropper, ImageCropper,
BlockList, BlockList,
@ -78,8 +80,8 @@ const UserSettings = {
pleromaBackend () { pleromaBackend () {
return this.$store.state.instance.pleromaBackend return this.$store.state.instance.pleromaBackend
}, },
scopeOptionsEnabled () { scopeOptionsMinimal () {
return this.$store.state.instance.scopeOptionsEnabled return this.$store.state.instance.scopeOptionsMinimal
}, },
vis () { vis () {
return { return {

View File

@ -29,13 +29,13 @@
<input type="checkbox" v-model="newLocked" id="account-locked"> <input type="checkbox" v-model="newLocked" id="account-locked">
<label for="account-locked">{{$t('settings.lock_account_description')}}</label> <label for="account-locked">{{$t('settings.lock_account_description')}}</label>
</p> </p>
<div v-if="scopeOptionsEnabled"> <div>
<label for="default-vis">{{$t('settings.default_vis')}}</label> <label for="default-vis">{{$t('settings.default_vis')}}</label>
<div id="default-vis" class="visibility-tray"> <div id="default-vis" class="visibility-tray">
<i v-on:click="changeVis('direct')" class="icon-mail-alt" :class="vis.direct" :title="$t('post_status.scope.direct')" ></i> <scope-selector
<i v-on:click="changeVis('private')" class="icon-lock" :class="vis.private" :title="$t('post_status.scope.private')"></i> :showAll="true"
<i v-on:click="changeVis('unlisted')" class="icon-lock-open-alt" :class="vis.unlisted" :title="$t('post_status.scope.unlisted')"></i> :userDefault="newDefaultScope"
<i v-on:click="changeVis('public')" class="icon-globe" :class="vis.public" :title="$t('post_status.scope.public')"></i> :onScopeChange="changeVis"/>
</div> </div>
</div> </div>
<p> <p>

View File

@ -211,6 +211,7 @@
"saving_ok": "Settings saved", "saving_ok": "Settings saved",
"security_tab": "Security", "security_tab": "Security",
"scope_copy": "Copy scope when replying (DMs are always copied)", "scope_copy": "Copy scope when replying (DMs are always copied)",
"minimal_scopes_mode": "Minimize post scope selection options",
"set_new_avatar": "Set new avatar", "set_new_avatar": "Set new avatar",
"set_new_profile_background": "Set new profile background", "set_new_profile_background": "Set new profile background",
"set_new_profile_banner": "Set new profile banner", "set_new_profile_banner": "Set new profile banner",

View File

@ -111,6 +111,8 @@
"import_theme": "Загрузить Тему", "import_theme": "Загрузить Тему",
"inputRadius": "Поля ввода", "inputRadius": "Поля ввода",
"checkboxRadius": "Чекбоксы", "checkboxRadius": "Чекбоксы",
"instance_default": "(по умолчанию: {value})",
"instance_default_simple": "(по умолчанию)",
"interface": "Интерфейс", "interface": "Интерфейс",
"interfaceLanguage": "Язык интерфейса", "interfaceLanguage": "Язык интерфейса",
"limited_availability": "Не доступно в вашем браузере", "limited_availability": "Не доступно в вашем браузере",
@ -149,7 +151,11 @@
"reply_visibility_all": "Показывать все ответы", "reply_visibility_all": "Показывать все ответы",
"reply_visibility_following": "Показывать только ответы мне и тех на кого я подписан", "reply_visibility_following": "Показывать только ответы мне и тех на кого я подписан",
"reply_visibility_self": "Показывать только ответы мне", "reply_visibility_self": "Показывать только ответы мне",
"saving_err": "Не удалось сохранить настройки",
"saving_ok": "Сохранено",
"security_tab": "Безопасность", "security_tab": "Безопасность",
"scope_copy": "Копировать видимость поста при ответе (всегда включено для Личных Сообщений)",
"minimal_scopes_mode": "Минимизировать набор опций видимости поста",
"set_new_avatar": "Загрузить новый аватар", "set_new_avatar": "Загрузить новый аватар",
"set_new_profile_background": "Загрузить новый фон профиля", "set_new_profile_background": "Загрузить новый фон профиля",
"set_new_profile_banner": "Загрузить новый баннер профиля", "set_new_profile_banner": "Загрузить новый баннер профиля",
@ -164,6 +170,10 @@
"theme_help_v2_2": "Под некоторыми полями ввода это идикаторы контрастности, наведите на них мышью чтобы узнать больше. Приспользовании прозрачности контраст расчитывается для наихудшего варианта.", "theme_help_v2_2": "Под некоторыми полями ввода это идикаторы контрастности, наведите на них мышью чтобы узнать больше. Приспользовании прозрачности контраст расчитывается для наихудшего варианта.",
"tooltipRadius": "Всплывающие подсказки/уведомления", "tooltipRadius": "Всплывающие подсказки/уведомления",
"user_settings": "Настройки пользователя", "user_settings": "Настройки пользователя",
"values": {
"false": "нет",
"true": "да"
},
"style": { "style": {
"switcher": { "switcher": {
"keep_color": "Оставить цвета", "keep_color": "Оставить цвета",

View File

@ -32,7 +32,8 @@ const defaultState = {
scopeCopy: 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
} }
const config = { const config = {

View File

@ -15,7 +15,6 @@ const defaultState = {
redirectRootNoLogin: '/main/all', redirectRootNoLogin: '/main/all',
redirectRootLogin: '/main/friends', redirectRootLogin: '/main/friends',
showInstanceSpecificPanel: false, showInstanceSpecificPanel: false,
scopeOptionsEnabled: true,
formattingOptionsEnabled: false, formattingOptionsEnabled: false,
alwaysShowSubjectInput: true, alwaysShowSubjectInput: true,
collapseMessageWithSubject: false, collapseMessageWithSubject: false,
@ -31,6 +30,7 @@ const defaultState = {
vapidPublicKey: undefined, vapidPublicKey: undefined,
noAttachmentLinks: false, noAttachmentLinks: false,
showFeaturesPanel: true, showFeaturesPanel: true,
minimalScopesMode: false,
// Nasty stuff // Nasty stuff
pleromaBackend: true, pleromaBackend: true,

View File

@ -21,5 +21,6 @@
"webPushNotifications": false, "webPushNotifications": false,
"noAttachmentLinks": false, "noAttachmentLinks": false,
"nsfwCensorImage": "", "nsfwCensorImage": "",
"showFeaturesPanel": true "showFeaturesPanel": true,
"minimalScopesMode": false
} }