logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe
commit: 9e78eddf2ad846ee69bfef690cfe3765d1b55dcb
parent: ea28aa62f00663ab8a0e0bf64551ac15256a3242
Author: lambda <pleromagit@rogerbraun.net>
Date:   Mon,  3 Dec 2018 14:55:43 +0000

Merge branch 'subject-line-entry-auto' into 'develop'

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

Closes #174

See merge request pleroma/pleroma-fe!388

Diffstat:

Msrc/components/post_status_form/post_status_form.js9+++++++++
Msrc/components/post_status_form/post_status_form.vue2+-
Msrc/components/settings/settings.js7+++++++
Msrc/components/settings/settings.vue6++++++
Msrc/i18n/en.json1+
Msrc/i18n/ru.json1+
Msrc/modules/config.js3++-
Msrc/modules/instance.js1+
Mstatic/config.json1+
9 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js @@ -150,6 +150,15 @@ const PostStatusForm = { 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 () { return this.$store.state.instance.formattingOptionsEnabled } diff --git a/src/components/post_status_form/post_status_form.vue b/src/components/post_status_form/post_status_form.vue @@ -11,7 +11,7 @@ </i18n> <p v-if="this.newStatus.visibility == 'direct'" class="visibility-notice">{{ $t('post_status.direct_warning') }}</p> <input - v-if="scopeOptionsEnabled" + v-if="newStatus.spoilerText || alwaysShowSubject" type="text" :placeholder="$t('post_status.content_warning')" v-model="newStatus.spoilerText" diff --git a/src/components/settings/settings.js b/src/components/settings/settings.js @@ -38,6 +38,10 @@ const settings = { ? instance.subjectLineBehavior : user.subjectLineBehavior, subjectLineBehaviorDefault: instance.subjectLineBehavior, + alwaysShowSubjectInputLocal: typeof user.alwaysShowSubjectInput === 'undefined' + ? instance.alwaysShowSubjectInput + : user.alwaysShowSubjectInput, + alwaysShowSubjectInputDefault: instance.alwaysShowSubjectInput, scopeCopyLocal: user.scopeCopy, scopeCopyDefault: this.$t('settings.values.' + instance.scopeCopy), stopGifs: user.stopGifs, @@ -122,6 +126,9 @@ const settings = { scopeCopyLocal (value) { this.$store.dispatch('setOption', { name: 'scopeCopy', value }) }, + alwaysShowSubjectInputLocal (value) { + this.$store.dispatch('setOption', { name: 'alwaysShowSubjectInput', value }) + }, subjectLineBehaviorLocal (value) { this.$store.dispatch('setOption', { name: 'subjectLineBehavior', value }) }, diff --git a/src/components/settings/settings.vue b/src/components/settings/settings.vue @@ -64,6 +64,12 @@ </label> </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> <div> {{$t('settings.subject_line_behavior')}} <label for="subjectLineBehavior" class="select"> diff --git a/src/i18n/en.json b/src/i18n/en.json @@ -159,6 +159,7 @@ "set_new_profile_background": "Set new profile background", "set_new_profile_banner": "Set new profile banner", "settings": "Settings", + "subject_input_always_show": "Always show subject field", "subject_line_behavior": "Copy subject when replying", "subject_line_email": "Like email: \"re: subject\"", "subject_line_mastodon": "Like mastodon: copy as is", diff --git a/src/i18n/ru.json b/src/i18n/ru.json @@ -133,6 +133,7 @@ "set_new_profile_background": "Загрузить новый фон профиля", "set_new_profile_banner": "Загрузить новый баннер профиля", "settings": "Настройки", + "subject_input_always_show": "Всегда показывать поле ввода темы", "stop_gifs": "Проигрывать GIF анимации только при наведении", "streaming": "Включить автоматическую загрузку новых сообщений при прокрутке вверх", "text": "Текст", diff --git a/src/modules/config.js b/src/modules/config.js @@ -27,7 +27,8 @@ const defaultState = { highlight: {}, interfaceLanguage: browserLocale, scopeCopy: undefined, // instance default - subjectLineBehavior: undefined // instance default + subjectLineBehavior: undefined, // instance default + alwaysShowSubjectInput: undefined // instance default } const config = { diff --git a/src/modules/instance.js b/src/modules/instance.js @@ -17,6 +17,7 @@ const defaultState = { showInstanceSpecificPanel: false, scopeOptionsEnabled: true, formattingOptionsEnabled: false, + alwaysShowSubjectInput: true, collapseMessageWithSubject: false, hidePostStats: false, hideUserStats: false, diff --git a/static/config.json b/static/config.json @@ -13,6 +13,7 @@ "collapseMessageWithSubject": false, "scopeCopy": false, "subjectLineBehavior": "email", + "alwaysShowSubjectInput": true, "hidePostStats": false, "hideUserStats": false, "loginMethod": "password"