commit: a1962a610aa44a0dae20378889a29311af5b8fd4
parent: 2f11ec296ec9540c164f88341663d4000b943c82
Author: lambda <pleromagit@rogerbraun.net>
Date:   Wed,  7 Nov 2018 22:15:47 +0000
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
Diffstat:
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js
@@ -53,7 +53,7 @@ const PostStatusForm = {
       posting: false,
       highlighted: 0,
       newStatus: {
-        spoilerText: this.subject,
+        spoilerText: this.subject || '',
         status: statusText,
         contentType: 'text/plain',
         nsfw: false,
@@ -128,6 +128,9 @@ const PostStatusForm = {
     statusLength () {
       return this.newStatus.status.length
     },
+    spoilerTextLength () {
+      return this.newStatus.spoilerText.length
+    },
     statusLengthLimit () {
       return this.$store.state.instance.textlimit
     },
@@ -135,10 +138,10 @@ const PostStatusForm = {
       return this.statusLengthLimit > 0
     },
     charactersLeft () {
-      return this.statusLengthLimit - this.statusLength
+      return this.statusLengthLimit - (this.statusLength + this.spoilerTextLength)
     },
     isOverLengthLimit () {
-      return this.hasStatusLengthLimit && (this.statusLength > this.statusLengthLimit)
+      return this.hasStatusLengthLimit && (this.charactersLeft < 0)
     },
     scopeOptionsEnabled () {
       return this.$store.state.instance.scopeOptionsEnabled