From 5385797ff1096a140bbbcd03091dec9795920adb Mon Sep 17 00:00:00 2001 From: sfr Date: Tue, 12 Jul 2022 09:04:28 +0000 Subject: [PATCH] Smarter scope copy (#28) Reviewed-on: https://akkoma.dev/AkkomaGang/pleroma-fe/pulls/28 Co-authored-by: sfr Co-committed-by: sfr --- .../post_status_form/post_status_form.js | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js index 52b69fd1..19504169 100644 --- a/src/components/post_status_form/post_status_form.js +++ b/src/components/post_status_form/post_status_form.js @@ -112,17 +112,11 @@ const PostStatusForm = { const preset = this.$route.query.message let statusText = preset || '' - const { scopeCopy } = this.$store.getters.mergedConfig - if (this.replyTo) { const currentUser = this.$store.state.users.currentUser statusText = buildMentionsString({ user: this.repliedUser, attentions: this.attentions }, currentUser) } - const scope = ((this.copyMessageScope && scopeCopy) || this.copyMessageScope === 'direct') - ? this.copyMessageScope - : this.$store.state.users.currentUser.default_scope - const { postContentType: contentType, sensitiveByDefault, sensitiveIfSubject } = this.$store.getters.mergedConfig return { @@ -139,7 +133,7 @@ const PostStatusForm = { files: [], poll: {}, mediaDescriptions: {}, - visibility: scope, + visibility: this.suggestedVisibility(), contentType }, caret: 0, @@ -614,6 +608,19 @@ const PostStatusForm = { }, openProfileTab () { this.$store.dispatch('openSettingsModalTab', 'profile') + }, + suggestedVisibility () { + if (this.copyMessageScope) { + if (this.copyMessageScope === 'direct') { + return this.copyMessageScope + } + if (this.$store.getters.mergedConfig.scopeCopy) { + if (this.copyMessageScope !== 'public' && this.$store.state.users.currentUser.default_scope !== 'private') { + return this.copyMessageScope + } + } + } + return this.$store.state.users.currentUser.default_scope } } }