From c6798864d4d8be821e4393ce0ca95b01f8ea7f5b Mon Sep 17 00:00:00 2001 From: Shpuld Shpuldson Date: Thu, 24 Aug 2017 16:16:06 +0300 Subject: [PATCH 1/2] Add an X icon to clear error message from post status form, hack to allow posting empty statuses if they have attachments --- src/components/post_status_form/post_status_form.js | 13 +++++++++++++ .../post_status_form/post_status_form.vue | 2 ++ 2 files changed, 15 insertions(+) diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js index af5b81d4..d028b9ec 100644 --- a/src/components/post_status_form/post_status_form.js +++ b/src/components/post_status_form/post_status_form.js @@ -88,6 +88,16 @@ const PostStatusForm = { }, postStatus (newStatus) { if (this.posting) { return } + + if (this.newStatus.status === '') { + if (this.newStatus.files.length > 0) { + this.newStatus.status = '\u200b' // hack + } else { + this.error = 'Cannot post an empty status with no files' + return; + } + } + this.posting = true statusPoster.postStatus({ status: newStatus.status, @@ -142,6 +152,9 @@ const PostStatusForm = { if (e.target.value === '') { e.target.style.height = '16px' } + }, + clearError () { + this.error = null } } } diff --git a/src/components/post_status_form/post_status_form.vue b/src/components/post_status_form/post_status_form.vue index e775c45e..ec479215 100644 --- a/src/components/post_status_form/post_status_form.vue +++ b/src/components/post_status_form/post_status_form.vue @@ -22,6 +22,7 @@
Error: {{ error }} +
@@ -71,6 +72,7 @@ background-color: rgba(255, 48, 16, 0.65); padding: 0.25em; margin: 0.35em; + display: flex; } .attachments { From 7061675e9664e49278758f1bfa022b8b07fe3053 Mon Sep 17 00:00:00 2001 From: Shpuld Shpuldson Date: Thu, 24 Aug 2017 16:25:26 +0300 Subject: [PATCH 2/2] whoops lint --- src/components/post_status_form/post_status_form.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js index d028b9ec..86bf2fa7 100644 --- a/src/components/post_status_form/post_status_form.js +++ b/src/components/post_status_form/post_status_form.js @@ -94,7 +94,7 @@ const PostStatusForm = { this.newStatus.status = '\u200b' // hack } else { this.error = 'Cannot post an empty status with no files' - return; + return } }