Skip to content
Snippets Groups Projects
Commit 5b2fbad6 authored by Lukas Mauß's avatar Lukas Mauß
Browse files

Merge branch 'fixVoting' into 'master'

Set userId for voting...

See merge request swtp-2019/arsnova-lite!43
parents 96ec0025 69142207
Branches
Tags
No related merge requests found
......@@ -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;
}
}
......
......@@ -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));
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment