diff options
| author | Syndamia <kamen.d.mladenov@protonmail.com> | 2021-02-25 14:26:14 +0200 |
|---|---|---|
| committer | Syndamia <kamen.d.mladenov@protonmail.com> | 2021-02-25 14:26:14 +0200 |
| commit | 7213d280eac242e8df5403120f59742fb1855a24 (patch) | |
| tree | b3736ba2d6dc8a3ddb03f2ff50560655f00b1387 /src/app/components/comment-page/comment-page.component.ts | |
| parent | 82313933306c3e24434ea81a8a34710e92aa4b01 (diff) | |
| download | DevHive-Angular-7213d280eac242e8df5403120f59742fb1855a24.tar DevHive-Angular-7213d280eac242e8df5403120f59742fb1855a24.tar.gz DevHive-Angular-7213d280eac242e8df5403120f59742fb1855a24.zip | |
Editing comment message has the current message by default, if the message isn't changed, the comment doesn't get updated
Diffstat (limited to 'src/app/components/comment-page/comment-page.component.ts')
| -rw-r--r-- | src/app/components/comment-page/comment-page.component.ts | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/app/components/comment-page/comment-page.component.ts b/src/app/components/comment-page/comment-page.component.ts index bd4cfe5..045e8ea 100644 --- a/src/app/components/comment-page/comment-page.component.ts +++ b/src/app/components/comment-page/comment-page.component.ts @@ -38,6 +38,7 @@ export class CommentPageComponent implements OnInit { this.comment = result as Comment; if (this.loggedIn) { this.editable = this.comment.issuerUsername === this._tokenService.getUsernameFromSessionStorageToken(); + this.editCommentFormGroup.get('newCommentMessage')?.setValue(this.comment.message); } this.loaded = true; }, @@ -63,7 +64,8 @@ export class CommentPageComponent implements OnInit { if (this.editingComment) { const newMessage = this.editCommentFormGroup.get('newCommentMessage')?.value; - if (newMessage !== '') { + + if (newMessage !== '' && newMessage !== this.comment.message) { console.log(this.commentId); this._commentService.putCommentWithSessionStorageRequest(this.commentId, this.comment.postId, newMessage).subscribe( (result: object) => { |
