Automatically tick sensitive if a subject line is specified

also adds a warning
This commit is contained in:
FloatingGhost 2022-06-28 14:15:23 +01:00
parent 716320de35
commit 15ed2671e9
3 changed files with 21 additions and 3 deletions

View File

@ -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 }

View File

@ -124,8 +124,18 @@
:disabled="posting && !optimisticPosting"
size="1"
class="form-post-subject"
@input="onSubjectInput"
>
</EmojiInput>
<i18n-t
v-if="newStatus.files.length !== 0 && newStatus.nsfw === false && newStatus.spoilerText !== ''"
keypath="post_status.media_not_sensitive_warning"
tag="p"
class="visibility-notice"
scope="global"
>
{{ $t('post_status.media_not_sensitive_warning') }}
</i18n-t>
<EmojiInput
ref="emoji-input"
v-model="newStatus.status"

View File

@ -204,6 +204,7 @@
"new_status": "Post new status",
"account_not_locked_warning": "Your account is not {0}. Anyone can follow you to view your follower-only posts.",
"account_not_locked_warning_link": "locked",
"media_not_sensitive_warning": "You have a Content Warning, but the attachments are not marked as sensitive!",
"attachments_sensitive": "Mark attachments as sensitive",
"media_description": "Media description",
"content_type": {