Merge branch '153-count-cw' into 'develop'

Resolve "PleromaFE does not count the Content Warning into Post length"

Closes #153 and #135

See merge request pleroma/pleroma-fe!371
This commit is contained in:
lambda 2018-11-07 22:15:47 +00:00
commit a1962a610a

View file

@ -53,7 +53,7 @@ const PostStatusForm = {
posting: false, posting: false,
highlighted: 0, highlighted: 0,
newStatus: { newStatus: {
spoilerText: this.subject, spoilerText: this.subject || '',
status: statusText, status: statusText,
contentType: 'text/plain', contentType: 'text/plain',
nsfw: false, nsfw: false,
@ -128,6 +128,9 @@ const PostStatusForm = {
statusLength () { statusLength () {
return this.newStatus.status.length return this.newStatus.status.length
}, },
spoilerTextLength () {
return this.newStatus.spoilerText.length
},
statusLengthLimit () { statusLengthLimit () {
return this.$store.state.instance.textlimit return this.$store.state.instance.textlimit
}, },
@ -135,10 +138,10 @@ const PostStatusForm = {
return this.statusLengthLimit > 0 return this.statusLengthLimit > 0
}, },
charactersLeft () { charactersLeft () {
return this.statusLengthLimit - this.statusLength return this.statusLengthLimit - (this.statusLength + this.spoilerTextLength)
}, },
isOverLengthLimit () { isOverLengthLimit () {
return this.hasStatusLengthLimit && (this.statusLength > this.statusLengthLimit) return this.hasStatusLengthLimit && (this.charactersLeft < 0)
}, },
scopeOptionsEnabled () { scopeOptionsEnabled () {
return this.$store.state.instance.scopeOptionsEnabled return this.$store.state.instance.scopeOptionsEnabled