forked from AkkomaGang/akkoma-fe
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:
parent
716320de35
commit
6e641a99a2
4 changed files with 22 additions and 4 deletions
|
@ -281,8 +281,6 @@ const PostStatusForm = {
|
||||||
if (this.preview) this.previewStatus()
|
if (this.preview) this.previewStatus()
|
||||||
},
|
},
|
||||||
async postStatus (event, newStatus, opts = {}) {
|
async postStatus (event, newStatus, opts = {}) {
|
||||||
const { sensitiveIfSubject } = this.$store.getters.mergedConfig
|
|
||||||
|
|
||||||
if (this.posting && !this.optimisticPosting) { return }
|
if (this.posting && !this.optimisticPosting) { return }
|
||||||
if (this.disableSubmit) { return }
|
if (this.disableSubmit) { return }
|
||||||
if (this.emojiInputShown) { return }
|
if (this.emojiInputShown) { return }
|
||||||
|
@ -318,7 +316,7 @@ const PostStatusForm = {
|
||||||
status: newStatus.status,
|
status: newStatus.status,
|
||||||
spoilerText: newStatus.spoilerText || null,
|
spoilerText: newStatus.spoilerText || null,
|
||||||
visibility: newStatus.visibility,
|
visibility: newStatus.visibility,
|
||||||
sensitive: (newStatus.nsfw || (sensitiveIfSubject && newStatus.spoilerText)),
|
sensitive: newStatus.nsfw,
|
||||||
media: newStatus.files,
|
media: newStatus.files,
|
||||||
store: this.$store,
|
store: this.$store,
|
||||||
inReplyToStatusId: this.replyTo,
|
inReplyToStatusId: this.replyTo,
|
||||||
|
@ -392,6 +390,10 @@ const PostStatusForm = {
|
||||||
},
|
},
|
||||||
addMediaFile (fileInfo) {
|
addMediaFile (fileInfo) {
|
||||||
this.newStatus.files.push(fileInfo)
|
this.newStatus.files.push(fileInfo)
|
||||||
|
|
||||||
|
if (this.newStatus.sensitiveIfSubject && this.newStatus.spoilerText !== '') {
|
||||||
|
this.newStatus.nsfw = true
|
||||||
|
}
|
||||||
this.$emit('resize', { delayed: true })
|
this.$emit('resize', { delayed: true })
|
||||||
},
|
},
|
||||||
removeMediaFile (fileInfo) {
|
removeMediaFile (fileInfo) {
|
||||||
|
@ -468,6 +470,11 @@ const PostStatusForm = {
|
||||||
this.resize(this.$refs['textarea'])
|
this.resize(this.$refs['textarea'])
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
onSubjectInput (e) {
|
||||||
|
if (this.newStatus.sensitiveIfSubject) {
|
||||||
|
this.newStatus.nsfw = true
|
||||||
|
}
|
||||||
|
},
|
||||||
resize (e) {
|
resize (e) {
|
||||||
const target = e.target || e
|
const target = e.target || e
|
||||||
if (!(target instanceof window.Element)) { return }
|
if (!(target instanceof window.Element)) { return }
|
||||||
|
|
|
@ -124,8 +124,18 @@
|
||||||
:disabled="posting && !optimisticPosting"
|
:disabled="posting && !optimisticPosting"
|
||||||
size="1"
|
size="1"
|
||||||
class="form-post-subject"
|
class="form-post-subject"
|
||||||
|
@input="onSubjectInput"
|
||||||
>
|
>
|
||||||
</EmojiInput>
|
</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
|
<EmojiInput
|
||||||
ref="emoji-input"
|
ref="emoji-input"
|
||||||
v-model="newStatus.status"
|
v-model="newStatus.status"
|
||||||
|
|
|
@ -204,6 +204,7 @@
|
||||||
"new_status": "Post new status",
|
"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": "Your account is not {0}. Anyone can follow you to view your follower-only posts.",
|
||||||
"account_not_locked_warning_link": "locked",
|
"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",
|
"attachments_sensitive": "Mark attachments as sensitive",
|
||||||
"media_description": "Media description",
|
"media_description": "Media description",
|
||||||
"content_type": {
|
"content_type": {
|
||||||
|
|
|
@ -54,7 +54,7 @@ const defaultState = {
|
||||||
theme: 'pleroma-dark',
|
theme: 'pleroma-dark',
|
||||||
virtualScrolling: true,
|
virtualScrolling: true,
|
||||||
sensitiveByDefault: false,
|
sensitiveByDefault: false,
|
||||||
sensitiveIfSubject: false,
|
sensitiveIfSubject: true,
|
||||||
renderMisskeyMarkdown: false,
|
renderMisskeyMarkdown: false,
|
||||||
conversationDisplay: 'linear',
|
conversationDisplay: 'linear',
|
||||||
conversationTreeAdvanced: false,
|
conversationTreeAdvanced: false,
|
||||||
|
|
Loading…
Reference in a new issue