1
0
Fork 0
forked from srxl/akkoma-fe

Merge branch 'feature/post-status-clear-error-message' into 'develop'

Feature/post status clear error message

See merge request !108
This commit is contained in:
Shpuld Shpuldson 2017-08-24 09:34:09 -04:00
commit 205024ba9d
2 changed files with 15 additions and 0 deletions

View file

@ -88,6 +88,16 @@ const PostStatusForm = {
}, },
postStatus (newStatus) { postStatus (newStatus) {
if (this.posting) { return } 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 this.posting = true
statusPoster.postStatus({ statusPoster.postStatus({
status: newStatus.status, status: newStatus.status,
@ -142,6 +152,9 @@ const PostStatusForm = {
if (e.target.value === '') { if (e.target.value === '') {
e.target.style.height = '16px' e.target.style.height = '16px'
} }
},
clearError () {
this.error = null
} }
} }
} }

View file

@ -22,6 +22,7 @@
</div> </div>
<div class='error' v-if="error"> <div class='error' v-if="error">
Error: {{ error }} Error: {{ error }}
<i class="icon-cancel" @click="clearError"></i>
</div> </div>
<div class="attachments"> <div class="attachments">
<div class="attachment" v-for="file in newStatus.files"> <div class="attachment" v-for="file in newStatus.files">
@ -71,6 +72,7 @@
background-color: rgba(255, 48, 16, 0.65); background-color: rgba(255, 48, 16, 0.65);
padding: 0.25em; padding: 0.25em;
margin: 0.35em; margin: 0.35em;
display: flex;
} }
.attachments { .attachments {