diff --git a/src/app/components/shared/comment/comment.component.ts b/src/app/components/shared/comment/comment.component.ts index 64098002ef8eee3961fad84784c77f58a204739c..b9f315b9591c01e23adbd190345e8020aeb4a949 100644 --- a/src/app/components/shared/comment/comment.component.ts +++ b/src/app/components/shared/comment/comment.component.ts @@ -91,15 +91,17 @@ export class CommentComponent implements OnInit { } voteUp(comment: Comment): void { + const userId = this.authenticationService.getUser().id; if (this.hasVoted !== 1) { - this.wsCommentService.voteUp(comment); + this.wsCommentService.voteUp(comment, userId); this.hasVoted = 1; } } voteDown(comment: Comment): void { + const userId = this.authenticationService.getUser().id; if (this.hasVoted !== -1) { - this.wsCommentService.voteDown(comment); + this.wsCommentService.voteDown(comment, userId); this.hasVoted = -1; } } diff --git a/src/app/services/websockets/ws-comment-service.service.ts b/src/app/services/websockets/ws-comment-service.service.ts index 81b21ac3b8dbf715e17f1a72cfdc9c998901d0b4..43f47fd68b5d1a206bf8dd8ea8e303586c5a9865 100644 --- a/src/app/services/websockets/ws-comment-service.service.ts +++ b/src/app/services/websockets/ws-comment-service.service.ts @@ -48,13 +48,13 @@ export class WsCommentServiceService { return comment; } - voteUp(comment: Comment): void { - const message = new UpVote(comment.userId, comment.id); + voteUp(comment: Comment, userId: string): void { + const message = new UpVote(userId, comment.id); this.wsConnector.send(`/queue/vote.command.upvote`, JSON.stringify(message)); } - voteDown(comment: Comment): void { - const message = new DownVote(comment.userId, comment.id); + voteDown(comment: Comment, userId: string): void { + const message = new DownVote(userId, comment.id); this.wsConnector.send(`/queue/vote.command.downvote`, JSON.stringify(message)); }