Show warning if a post has a subject line but is not marked as sensitive (#24)

Reviewed-on: AkkomaGang/pleroma-fe#24
This commit is contained in:
floatingghost 2022-06-28 13:53:12 +00:00
parent 716320de35
commit 6e641a99a2
4 changed files with 22 additions and 4 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": {

View file

@ -54,7 +54,7 @@ const defaultState = {
theme: 'pleroma-dark',
virtualScrolling: true,
sensitiveByDefault: false,
sensitiveIfSubject: false,
sensitiveIfSubject: true,
renderMisskeyMarkdown: false,
conversationDisplay: 'linear',
conversationTreeAdvanced: false,