Added option to auto-hide subject field when it's empty.

This commit is contained in:
Henry Jameson 2018-12-03 06:47:35 +03:00
parent e15b9bddbb
commit b34097a5c1
9 changed files with 29 additions and 2 deletions

View File

@ -150,6 +150,15 @@ const PostStatusForm = {
scopeOptionsEnabled () { scopeOptionsEnabled () {
return this.$store.state.instance.scopeOptionsEnabled return this.$store.state.instance.scopeOptionsEnabled
}, },
alwaysShowSubject () {
if (typeof this.$store.state.config.alwaysShowSubjectInput !== 'undefined') {
return this.$store.state.config.alwaysShowSubjectInput
} else if (typeof this.$store.state.instance.alwaysShowSubjectInput !== 'undefined') {
return this.$store.state.instance.alwaysShowSubjectInput
} else {
return this.$store.state.instance.scopeOptionsEnabled
}
},
formattingOptionsEnabled () { formattingOptionsEnabled () {
return this.$store.state.instance.formattingOptionsEnabled return this.$store.state.instance.formattingOptionsEnabled
} }

View File

@ -11,7 +11,7 @@
</i18n> </i18n>
<p v-if="this.newStatus.visibility == 'direct'" class="visibility-notice">{{ $t('post_status.direct_warning') }}</p> <p v-if="this.newStatus.visibility == 'direct'" class="visibility-notice">{{ $t('post_status.direct_warning') }}</p>
<input <input
v-if="scopeOptionsEnabled" v-if="newStatus.spoilerText || alwaysShowSubject"
type="text" type="text"
:placeholder="$t('post_status.content_warning')" :placeholder="$t('post_status.content_warning')"
v-model="newStatus.spoilerText" v-model="newStatus.spoilerText"

View File

@ -38,6 +38,10 @@ const settings = {
? instance.subjectLineBehavior ? instance.subjectLineBehavior
: user.subjectLineBehavior, : user.subjectLineBehavior,
subjectLineBehaviorDefault: instance.subjectLineBehavior, subjectLineBehaviorDefault: instance.subjectLineBehavior,
alwaysShowSubjectInputLocal: typeof user.alwaysShowSubjectInput === 'undefined'
? instance.alwaysShowSubjectInput
: user.alwaysShowSubjectInput,
alwaysShowSubjectInputDefault: instance.alwaysShowSubjectInput,
scopeCopyLocal: user.scopeCopy, scopeCopyLocal: user.scopeCopy,
scopeCopyDefault: this.$t('settings.values.' + instance.scopeCopy), scopeCopyDefault: this.$t('settings.values.' + instance.scopeCopy),
stopGifs: user.stopGifs, stopGifs: user.stopGifs,
@ -122,6 +126,9 @@ const settings = {
scopeCopyLocal (value) { scopeCopyLocal (value) {
this.$store.dispatch('setOption', { name: 'scopeCopy', value }) this.$store.dispatch('setOption', { name: 'scopeCopy', value })
}, },
alwaysShowSubjectInputLocal (value) {
this.$store.dispatch('setOption', { name: 'alwaysShowSubjectInput', value })
},
subjectLineBehaviorLocal (value) { subjectLineBehaviorLocal (value) {
this.$store.dispatch('setOption', { name: 'subjectLineBehavior', value }) this.$store.dispatch('setOption', { name: 'subjectLineBehavior', value })
}, },

View File

@ -63,6 +63,12 @@
{{$t('settings.scope_copy')}} {{$t('settings.instance_default', { value: scopeCopyDefault })}} {{$t('settings.scope_copy')}} {{$t('settings.instance_default', { value: scopeCopyDefault })}}
</label> </label>
</li> </li>
<li>
<input type="checkbox" id="subjectHide" v-model="alwaysShowSubjectInputLocal">
<label for="subjectHide">
{{$t('settings.subject_input_always_show')}} {{$t('settings.instance_default', { value: alwaysShowSubjectInputDefault })}}
</label>
</li>
<li> <li>
<div> <div>
{{$t('settings.subject_line_behavior')}} {{$t('settings.subject_line_behavior')}}

View File

@ -159,6 +159,7 @@
"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",
"settings": "Settings", "settings": "Settings",
"subject_input_always_show": "Always show subject field",
"subject_line_behavior": "Copy subject when replying", "subject_line_behavior": "Copy subject when replying",
"subject_line_email": "Like email: \"re: subject\"", "subject_line_email": "Like email: \"re: subject\"",
"subject_line_mastodon": "Like mastodon: copy as is", "subject_line_mastodon": "Like mastodon: copy as is",

View File

@ -133,6 +133,7 @@
"set_new_profile_background": "Загрузить новый фон профиля", "set_new_profile_background": "Загрузить новый фон профиля",
"set_new_profile_banner": "Загрузить новый баннер профиля", "set_new_profile_banner": "Загрузить новый баннер профиля",
"settings": "Настройки", "settings": "Настройки",
"subject_input_always_show": "Всегда показывать поле ввода темы",
"stop_gifs": "Проигрывать GIF анимации только при наведении", "stop_gifs": "Проигрывать GIF анимации только при наведении",
"streaming": "Включить автоматическую загрузку новых сообщений при прокрутке вверх", "streaming": "Включить автоматическую загрузку новых сообщений при прокрутке вверх",
"text": "Текст", "text": "Текст",

View File

@ -27,7 +27,8 @@ const defaultState = {
highlight: {}, highlight: {},
interfaceLanguage: browserLocale, interfaceLanguage: browserLocale,
scopeCopy: undefined, // instance default scopeCopy: undefined, // instance default
subjectLineBehavior: undefined // instance default subjectLineBehavior: undefined, // instance default
alwaysShowSubjectInput: undefined // instance default
} }
const config = { const config = {

View File

@ -17,6 +17,7 @@ const defaultState = {
showInstanceSpecificPanel: false, showInstanceSpecificPanel: false,
scopeOptionsEnabled: true, scopeOptionsEnabled: true,
formattingOptionsEnabled: false, formattingOptionsEnabled: false,
alwaysShowSubjectInput: true,
collapseMessageWithSubject: false, collapseMessageWithSubject: false,
hidePostStats: false, hidePostStats: false,
hideUserStats: false, hideUserStats: false,

View File

@ -13,6 +13,7 @@
"collapseMessageWithSubject": false, "collapseMessageWithSubject": false,
"scopeCopy": false, "scopeCopy": false,
"subjectLineBehavior": "email", "subjectLineBehavior": "email",
"alwaysShowSubjectInput": true,
"hidePostStats": false, "hidePostStats": false,
"hideUserStats": false, "hideUserStats": false,
"loginMethod": "password" "loginMethod": "password"