Skip to content

Commit

Permalink
fix($vssue): disable textarea if issue is not ready
Browse files Browse the repository at this point in the history
  • Loading branch information
meteorlxy committed Jun 4, 2019
1 parent 2442151 commit 2ae723d
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions packages/vssue/src/components/VssueNewComment.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
ref="input"
class="vssue-new-comment-input"
:rows="inputRows"
:disabled="!user || loading"
:disabled="isInputDisabled"
:placeholder="vssue.$t(user ? 'placeholder' : 'noLoginPlaceHolder')"
:spellcheck="false"
v-model="content"
Expand Down Expand Up @@ -58,7 +58,7 @@
v-if="user"
class="vssue-button-submit-comment"
type="primary"
:disabled="disabled"
:disabled="isSubmitDisabled"
@click="submit()"
>
<VssueIcon
Expand Down Expand Up @@ -108,7 +108,11 @@ export default class VssueNewComment extends Vue {
return this.vssue.API && this.vssue.API.platform.name
}
get disabled (): boolean {
get isInputDisabled (): boolean {
return this.loading || this.user === null || this.vssue.issue === null
}
get isSubmitDisabled (): boolean {
return this.content === '' || this.vssue.isPending || this.vssue.issue === null
}
Expand Down Expand Up @@ -142,7 +146,7 @@ export default class VssueNewComment extends Vue {
}
async submit (): Promise<void> {
if (this.vssue.isPending) return
if (this.isSubmitDisabled) return
await this.vssue.postComment({ content: this.content })
this.content = ''
await this.vssue.getComments()
Expand Down

0 comments on commit 2ae723d

Please sign in to comment.