From b34097a5c154cb913048a16848d0ab0d48dfe626 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Mon, 3 Dec 2018 06:47:35 +0300 Subject: [PATCH] Added option to auto-hide subject field when it's empty. --- src/components/post_status_form/post_status_form.js | 9 +++++++++ src/components/post_status_form/post_status_form.vue | 2 +- src/components/settings/settings.js | 7 +++++++ src/components/settings/settings.vue | 6 ++++++ src/i18n/en.json | 1 + src/i18n/ru.json | 1 + src/modules/config.js | 3 ++- src/modules/instance.js | 1 + static/config.json | 1 + 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 index fa86ee5993..789243cf6b 100644 --- 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 index 42e9c65c22..e4c46b9ac3 100644 --- a/src/components/post_status_form/post_status_form.vue +++ b/src/components/post_status_form/post_status_form.vue @@ -11,7 +11,7 @@

{{ $t('post_status.direct_warning') }}

+
  • + + +
  • {{$t('settings.subject_line_behavior')}} diff --git a/src/i18n/en.json b/src/i18n/en.json index 314fa083a0..ae4f93d9ab 100644 --- 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 index 921bf67e69..9c28ccf4fe 100644 --- 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 index 0d36e9bf97..f23cacb776 100644 --- 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 index 9a39cccfb0..641424b6f5 100644 --- 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 index 67d84579f9..c49930efd3 100644 --- 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"