From befaa477a39234b9455faebfe54e90569013ebd0 Mon Sep 17 00:00:00 2001 From: eugenijm <eugenijm@protonmail.com> Date: Mon, 22 Apr 2019 18:25:21 +0300 Subject: [PATCH 1/3] Display additional scope description above the status form for mobile users. --- .../mobile_post_status_modal/mobile_post_status_modal.js | 6 +++++- .../mobile_post_status_modal/mobile_post_status_modal.vue | 4 ++-- src/components/post_status_form/post_status_form.js | 1 + 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/components/mobile_post_status_modal/mobile_post_status_modal.js b/src/components/mobile_post_status_modal/mobile_post_status_modal.js index 2f24dd08..eb665b8d 100644 --- a/src/components/mobile_post_status_modal/mobile_post_status_modal.js +++ b/src/components/mobile_post_status_modal/mobile_post_status_modal.js @@ -12,7 +12,8 @@ const MobilePostStatusModal = { scrollingDown: false, inputActive: false, oldScrollPos: 0, - amountScrolled: 0 + amountScrolled: 0, + visibility: this.$store.state.users.currentUser.default_scope } }, created () { @@ -32,6 +33,9 @@ const MobilePostStatusModal = { } }, methods: { + onScopeChange (visibility) { + this.visibility = visibility + }, openPostForm () { this.postFormOpen = true this.hidden = true diff --git a/src/components/mobile_post_status_modal/mobile_post_status_modal.vue b/src/components/mobile_post_status_modal/mobile_post_status_modal.vue index 0a451c28..ca431c5f 100644 --- a/src/components/mobile_post_status_modal/mobile_post_status_modal.vue +++ b/src/components/mobile_post_status_modal/mobile_post_status_modal.vue @@ -6,8 +6,8 @@ @click="closePostForm" > <div class="post-form-modal-panel panel" @click.stop=""> - <div class="panel-heading">{{$t('post_status.new_status')}}</div> - <PostStatusForm class="panel-body" @posted="closePostForm"/> + <div class="panel-heading">{{$t('post_status.new_status') + ' (' + $t('post_status.scope.' + visibility) + ')'}}</div> + <PostStatusForm class="panel-body" @posted="closePostForm" @onScopeChange="onScopeChange" /> </div> </div> <button diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js index c65c27e2..d956ebe6 100644 --- a/src/components/post_status_form/post_status_form.js +++ b/src/components/post_status_form/post_status_form.js @@ -338,6 +338,7 @@ const PostStatusForm = { }, changeVis (visibility) { this.newStatus.visibility = visibility + this.$emit('onScopeChange', visibility) } } } From 4af343374af30d781dd6b7a5298928339f6a425d Mon Sep 17 00:00:00 2001 From: eugenijm <eugenijm@protonmail.com> Date: Tue, 7 May 2019 19:13:45 +0300 Subject: [PATCH 2/3] Move scope visibility notice to the status form, make it dismissible --- .../mobile_post_status_modal.vue | 2 +- .../post_status_form/post_status_form.js | 6 ++++++ .../post_status_form/post_status_form.vue | 20 ++++++++++++++++++- src/i18n/en.json | 6 ++++++ src/modules/config.js | 1 + 5 files changed, 33 insertions(+), 2 deletions(-) diff --git a/src/components/mobile_post_status_modal/mobile_post_status_modal.vue b/src/components/mobile_post_status_modal/mobile_post_status_modal.vue index ca431c5f..c3cc5155 100644 --- a/src/components/mobile_post_status_modal/mobile_post_status_modal.vue +++ b/src/components/mobile_post_status_modal/mobile_post_status_modal.vue @@ -6,7 +6,7 @@ @click="closePostForm" > <div class="post-form-modal-panel panel" @click.stop=""> - <div class="panel-heading">{{$t('post_status.new_status') + ' (' + $t('post_status.scope.' + visibility) + ')'}}</div> + <div class="panel-heading">{{$t('post_status.new_status')}}</div> <PostStatusForm class="panel-body" @posted="closePostForm" @onScopeChange="onScopeChange" /> </div> </div> diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js index d956ebe6..998794bf 100644 --- a/src/components/post_status_form/post_status_form.js +++ b/src/components/post_status_form/post_status_form.js @@ -182,6 +182,9 @@ const PostStatusForm = { }, safeDMEnabled () { return this.$store.state.instance.safeDM + }, + hideScopeNotice () { + return this.$store.state.config.hideScopeNotice } }, methods: { @@ -339,6 +342,9 @@ const PostStatusForm = { changeVis (visibility) { this.newStatus.visibility = visibility this.$emit('onScopeChange', visibility) + }, + dismissScopeNotice () { + this.$store.dispatch('setOption', { name: 'hideScopeNotice', value: true }) } } } diff --git a/src/components/post_status_form/post_status_form.vue b/src/components/post_status_form/post_status_form.vue index 1ce2b647..15a466ec 100644 --- a/src/components/post_status_form/post_status_form.vue +++ b/src/components/post_status_form/post_status_form.vue @@ -9,7 +9,25 @@ class="visibility-notice"> <router-link :to="{ name: 'user-settings' }">{{ $t('post_status.account_not_locked_warning_link') }}</router-link> </i18n> - <p v-if="newStatus.visibility === 'direct'" class="visibility-notice"> + <p v-if="!hideScopeNotice && newStatus.visibility === 'public'" class="visibility-notice"> + <span>{{ $t('post_status.scope_notice.public') }}</span> + <a v-on:click.prevent="dismissScopeNotice()" style="float: right" class="button-icon"> + <i class='icon-cancel'></i> + </a> + </p> + <p v-else-if="!hideScopeNotice && newStatus.visibility === 'unlisted'" class="visibility-notice"> + <span>{{ $t('post_status.scope_notice.unlisted') }}</span> + <a v-on:click.prevent="dismissScopeNotice()" style="float: right" class="button-icon"> + <i class='icon-cancel'></i> + </a> + </p> + <p v-else-if="!hideScopeNotice && newStatus.visibility === 'private'" class="visibility-notice"> + <span>{{ $t('post_status.scope_notice.private') }}</span> + <a v-on:click.prevent="dismissScopeNotice()" style="float: right" class="button-icon"> + <i class='icon-cancel'></i> + </a> + </p> + <p v-else-if="newStatus.visibility === 'direct'" class="visibility-notice"> <span v-if="safeDMEnabled">{{ $t('post_status.direct_warning_to_first_only') }}</span> <span v-else>{{ $t('post_status.direct_warning_to_all') }}</span> </p> diff --git a/src/i18n/en.json b/src/i18n/en.json index 2f48c389..f98fa034 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -94,6 +94,12 @@ "direct_warning_to_all": "This post will be visible to all the mentioned users.", "direct_warning_to_first_only": "This post will only be visible to the mentioned users at the beginning of the message.", "posting": "Posting", + "scope_notice": { + "public": "Post to public timelines", + "private": "Post to followers only", + "unlisted": "Do not post to public timelines", + "direct": "Post to mentioned users only" + }, "scope": { "direct": "Direct - Post to mentioned users only", "private": "Followers-only - Post to followers only", diff --git a/src/modules/config.js b/src/modules/config.js index 1666a2c5..88969a97 100644 --- a/src/modules/config.js +++ b/src/modules/config.js @@ -30,6 +30,7 @@ const defaultState = { muteWords: [], highlight: {}, interfaceLanguage: browserLocale, + hideScopeNotice: false, scopeCopy: undefined, // instance default subjectLineBehavior: undefined, // instance default alwaysShowSubjectInput: undefined, // instance default From a89010843deb67f8c03e72ab8681b1de54b3259b Mon Sep 17 00:00:00 2001 From: eugenijm <eugenijm@protonmail.com> Date: Tue, 7 May 2019 22:32:47 +0300 Subject: [PATCH 3/3] Use more clear explanation in the scope notice, make sure the hide button doesn't overlap with text in notice. --- src/App.scss | 13 +++++++++++++ .../mobile_post_status_modal.js | 6 +----- .../mobile_post_status_modal.vue | 2 +- src/components/post_status_form/post_status_form.js | 1 - .../post_status_form/post_status_form.vue | 12 ++++++------ src/i18n/en.json | 7 +++---- src/i18n/ru.json | 7 ++++++- 7 files changed, 30 insertions(+), 18 deletions(-) diff --git a/src/App.scss b/src/App.scss index 921f2c3b..2729e0b0 100644 --- a/src/App.scss +++ b/src/App.scss @@ -648,6 +648,19 @@ nav { border-radius: var(--inputRadius, $fallback--inputRadius); } +.notice-dismissible { + padding-right: 4rem; + position: relative; + + .dismiss { + position: absolute; + top: 0; + right: 0; + padding: .5em; + color: inherit; + } +} + @keyframes modal-background-fadein { from { background-color: rgba(0, 0, 0, 0); diff --git a/src/components/mobile_post_status_modal/mobile_post_status_modal.js b/src/components/mobile_post_status_modal/mobile_post_status_modal.js index eb665b8d..2f24dd08 100644 --- a/src/components/mobile_post_status_modal/mobile_post_status_modal.js +++ b/src/components/mobile_post_status_modal/mobile_post_status_modal.js @@ -12,8 +12,7 @@ const MobilePostStatusModal = { scrollingDown: false, inputActive: false, oldScrollPos: 0, - amountScrolled: 0, - visibility: this.$store.state.users.currentUser.default_scope + amountScrolled: 0 } }, created () { @@ -33,9 +32,6 @@ const MobilePostStatusModal = { } }, methods: { - onScopeChange (visibility) { - this.visibility = visibility - }, openPostForm () { this.postFormOpen = true this.hidden = true diff --git a/src/components/mobile_post_status_modal/mobile_post_status_modal.vue b/src/components/mobile_post_status_modal/mobile_post_status_modal.vue index c3cc5155..c762705b 100644 --- a/src/components/mobile_post_status_modal/mobile_post_status_modal.vue +++ b/src/components/mobile_post_status_modal/mobile_post_status_modal.vue @@ -7,7 +7,7 @@ > <div class="post-form-modal-panel panel" @click.stop=""> <div class="panel-heading">{{$t('post_status.new_status')}}</div> - <PostStatusForm class="panel-body" @posted="closePostForm" @onScopeChange="onScopeChange" /> + <PostStatusForm class="panel-body" @posted="closePostForm" /> </div> </div> <button diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js index 998794bf..cbd2024a 100644 --- a/src/components/post_status_form/post_status_form.js +++ b/src/components/post_status_form/post_status_form.js @@ -341,7 +341,6 @@ const PostStatusForm = { }, changeVis (visibility) { this.newStatus.visibility = visibility - this.$emit('onScopeChange', visibility) }, dismissScopeNotice () { this.$store.dispatch('setOption', { name: 'hideScopeNotice', value: true }) diff --git a/src/components/post_status_form/post_status_form.vue b/src/components/post_status_form/post_status_form.vue index 15a466ec..b8b93936 100644 --- a/src/components/post_status_form/post_status_form.vue +++ b/src/components/post_status_form/post_status_form.vue @@ -9,21 +9,21 @@ class="visibility-notice"> <router-link :to="{ name: 'user-settings' }">{{ $t('post_status.account_not_locked_warning_link') }}</router-link> </i18n> - <p v-if="!hideScopeNotice && newStatus.visibility === 'public'" class="visibility-notice"> + <p v-if="!hideScopeNotice && newStatus.visibility === 'public'" class="visibility-notice notice-dismissible"> <span>{{ $t('post_status.scope_notice.public') }}</span> - <a v-on:click.prevent="dismissScopeNotice()" style="float: right" class="button-icon"> + <a v-on:click.prevent="dismissScopeNotice()" class="button-icon dismiss"> <i class='icon-cancel'></i> </a> </p> - <p v-else-if="!hideScopeNotice && newStatus.visibility === 'unlisted'" class="visibility-notice"> + <p v-else-if="!hideScopeNotice && newStatus.visibility === 'unlisted'" class="visibility-notice notice-dismissible"> <span>{{ $t('post_status.scope_notice.unlisted') }}</span> - <a v-on:click.prevent="dismissScopeNotice()" style="float: right" class="button-icon"> + <a v-on:click.prevent="dismissScopeNotice()" class="button-icon dismiss"> <i class='icon-cancel'></i> </a> </p> - <p v-else-if="!hideScopeNotice && newStatus.visibility === 'private'" class="visibility-notice"> + <p v-else-if="!hideScopeNotice && newStatus.visibility === 'private' && $store.state.users.currentUser.locked" class="visibility-notice notice-dismissible"> <span>{{ $t('post_status.scope_notice.private') }}</span> - <a v-on:click.prevent="dismissScopeNotice()" style="float: right" class="button-icon"> + <a v-on:click.prevent="dismissScopeNotice()" class="button-icon dismiss"> <i class='icon-cancel'></i> </a> </p> diff --git a/src/i18n/en.json b/src/i18n/en.json index f98fa034..6847646c 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -95,10 +95,9 @@ "direct_warning_to_first_only": "This post will only be visible to the mentioned users at the beginning of the message.", "posting": "Posting", "scope_notice": { - "public": "Post to public timelines", - "private": "Post to followers only", - "unlisted": "Do not post to public timelines", - "direct": "Post to mentioned users only" + "public": "This post will be visible to everyone", + "private": "This post will be visible to your followers only", + "unlisted": "This post will not be visible in Public Timeline and The Whole Known Network" }, "scope": { "direct": "Direct - Post to mentioned users only", diff --git a/src/i18n/ru.json b/src/i18n/ru.json index 5450f154..c4a55293 100644 --- a/src/i18n/ru.json +++ b/src/i18n/ru.json @@ -42,8 +42,13 @@ "attachments_sensitive": "Вложения содержат чувствительный контент", "content_warning": "Тема (не обязательно)", "default": "Что нового?", - "direct_warning": "Этот пост будет видет только упомянутым пользователям", + "direct_warning": "Этот пост будет виден только упомянутым пользователям", "posting": "Отправляется", + "scope_notice": { + "public": "Этот пост будет виден всем", + "private": "Этот пост будет виден только вашим подписчикам", + "unlisted": "Этот пост не будет виден в публичной и федеративной ленте" + }, "scope": { "direct": "Личное - этот пост видят только те кто в нём упомянут", "private": "Для подписчиков - этот пост видят только подписчики",