From 6e641a99a23799c4f65acc20011772d4d62cd8f6 Mon Sep 17 00:00:00 2001 From: floatingghost Date: Tue, 28 Jun 2022 13:53:12 +0000 Subject: [PATCH] Show warning if a post has a subject line but is not marked as sensitive (#24) Reviewed-on: https://akkoma.dev/AkkomaGang/pleroma-fe/pulls/24 --- src/components/post_status_form/post_status_form.js | 13 ++++++++++--- .../post_status_form/post_status_form.vue | 10 ++++++++++ src/i18n/en.json | 1 + src/modules/instance.js | 2 +- 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js index 617996a5..52b69fd1 100644 --- a/src/components/post_status_form/post_status_form.js +++ b/src/components/post_status_form/post_status_form.js @@ -281,8 +281,6 @@ const PostStatusForm = { if (this.preview) this.previewStatus() }, async postStatus (event, newStatus, opts = {}) { - const { sensitiveIfSubject } = this.$store.getters.mergedConfig - if (this.posting && !this.optimisticPosting) { return } if (this.disableSubmit) { return } if (this.emojiInputShown) { return } @@ -318,7 +316,7 @@ const PostStatusForm = { status: newStatus.status, spoilerText: newStatus.spoilerText || null, visibility: newStatus.visibility, - sensitive: (newStatus.nsfw || (sensitiveIfSubject && newStatus.spoilerText)), + sensitive: newStatus.nsfw, media: newStatus.files, store: this.$store, inReplyToStatusId: this.replyTo, @@ -392,6 +390,10 @@ const PostStatusForm = { }, addMediaFile (fileInfo) { this.newStatus.files.push(fileInfo) + + if (this.newStatus.sensitiveIfSubject && this.newStatus.spoilerText !== '') { + this.newStatus.nsfw = true + } this.$emit('resize', { delayed: true }) }, removeMediaFile (fileInfo) { @@ -468,6 +470,11 @@ const PostStatusForm = { this.resize(this.$refs['textarea']) }) }, + onSubjectInput (e) { + if (this.newStatus.sensitiveIfSubject) { + this.newStatus.nsfw = true + } + }, resize (e) { const target = e.target || e if (!(target instanceof window.Element)) { return } diff --git a/src/components/post_status_form/post_status_form.vue b/src/components/post_status_form/post_status_form.vue index 62613bd1..4824b723 100644 --- a/src/components/post_status_form/post_status_form.vue +++ b/src/components/post_status_form/post_status_form.vue @@ -124,8 +124,18 @@ :disabled="posting && !optimisticPosting" size="1" class="form-post-subject" + @input="onSubjectInput" > + + {{ $t('post_status.media_not_sensitive_warning') }} +