ActivityPub-federated video streaming platform using P2P directly in your web browser
Prevent commenting twice
Chocobozzzff33642709d7
diff --git a/client/src/app/videos/+video-watch/comment/video-comment-add.component.ts b/client/src/app/videos/+video-watch/comment/video-comment-add.component.tsindex 46d7a4e9eb..9998685e8f 100644--- a/client/src/app/videos/+video-watch/comment/video-comment-add.component.ts+++ b/client/src/app/videos/+video-watch/comment/video-comment-add.component.ts@@ -27,6 +27,8 @@ export class VideoCommentAddComponent extends FormReactive implements OnInit {@ViewChild('textarea') private textareaElement: ElementRef+ private addingComment = false+constructor (protected formValidatorService: FormValidatorService,private videoCommentValidatorsService: VideoCommentValidatorsService,@@ -66,6 +68,11 @@ export class VideoCommentAddComponent extends FormReactive implements OnInit {}formValidated () {+ // If we validate very quickly the comment form, we might comment twice+ if (this.addingComment) return++ this.addingComment = true+const commentCreate: VideoCommentCreate = this.form.valuelet obs: Observable<any>@@ -77,11 +84,16 @@ export class VideoCommentAddComponent extends FormReactive implements OnInit {obs.subscribe(comment => {+ this.addingComment = falsethis.commentCreated.emit(comment)this.form.reset()},- err => this.notificationsService.error(this.i18n('Error'), err.text)+ err => {+ this.addingComment = false++ this.notificationsService.error(this.i18n('Error'), err.text)+ })}