diff --git a/src/app/components/shared/comment/comment.component.html b/src/app/components/shared/comment/comment.component.html index bd009b1e970a3438c0d77feb16a6287ee4112155..03b0a3a05179060330766ff25a4455b5ad72da1e 100644 --- a/src/app/components/shared/comment/comment.component.html +++ b/src/app/components/shared/comment/comment.component.html @@ -300,7 +300,10 @@ <div *ngIf="!isStudent" fxLayout="column" fxLayoutAlign="center"> - <span class="scoreCreator">{{comment.score}}</span> + <span class="scoreCreator" matTooltip="{{ + ('comment-page.upvote' | translate) + ' ' + upvotes + ' | ' + + ('comment-page.downvote' | translate) + ' ' + downvotes + }}">{{comment.score}}</span> </div> </div> <ars-row #commentExpander diff --git a/src/app/components/shared/comment/comment.component.ts b/src/app/components/shared/comment/comment.component.ts index 76f7e91fabbe963999dcf967fdebed8b270e1494..e381d689c9885c928b944f8d3b90fee67437dd89 100644 --- a/src/app/components/shared/comment/comment.component.ts +++ b/src/app/components/shared/comment/comment.component.ts @@ -1,4 +1,4 @@ -import { Component, Input, Output, OnInit, EventEmitter, ViewChild, AfterViewInit } from '@angular/core'; +import { Component, Input, Output, OnInit, EventEmitter, ViewChild, AfterViewInit, OnDestroy } from '@angular/core'; import { Comment } from '../../../models/comment'; import { Vote } from '../../../models/vote'; import { AuthenticationService } from '../../../services/http/authentication.service'; @@ -34,7 +34,7 @@ import { UserBonusTokenComponent } from '../../participant/_dialogs/user-bonus-t ] }) -export class CommentComponent implements OnInit, AfterViewInit { +export class CommentComponent implements OnInit, AfterViewInit, OnDestroy { static COMMENT_MAX_HEIGHT = 200; @@ -65,6 +65,9 @@ export class CommentComponent implements OnInit, AfterViewInit { selectedKeyword = ''; filterProfanityForModerators = false; createdBy; + voteInterval; + upvotes; + downvotes; constructor(protected authenticationService: AuthenticationService, private route: ActivatedRoute, @@ -101,6 +104,18 @@ export class CommentComponent implements OnInit, AfterViewInit { this.translateService.use(this.language); this.deviceType = localStorage.getItem('deviceType'); this.inAnswerView = !this.router.url.includes('comments'); + this.voteInterval=setInterval(()=>{ + if(this.comment){ + this.commentService.getComment(this.comment.id).subscribe(e=>{ + this.upvotes=e.upvotes; + this.downvotes=e.downvotes; + }); + } + },1000); + } + + ngOnDestroy(){ + clearInterval(this.voteInterval); } checkProfanity(){ diff --git a/src/app/services/http/comment.service.ts b/src/app/services/http/comment.service.ts index 4befb9e3b9c3e04ce3cee7fa88f54f29484e8394..7f82202e349636db5dd774fcfb375547e6c621d2 100644 --- a/src/app/services/http/comment.service.ts +++ b/src/app/services/http/comment.service.ts @@ -235,7 +235,6 @@ export class CommentService extends BaseHttpService { comment.keywordsFromQuestioner = comment.keywordsFromQuestioner ? JSON.parse(comment.keywordsFromQuestioner as unknown as string) : null; comment.keywordsFromSpacy = comment.keywordsFromSpacy ? JSON.parse(comment.keywordsFromSpacy as unknown as string) : null; - console.log(comment); return comment; } diff --git a/src/assets/i18n/creator/de.json b/src/assets/i18n/creator/de.json index 381960d8ccb435e91a0e09b2c86d06aa58f0169a..23e81df1c3fe20b9c6ba0f67c527be7e80eec15d 100644 --- a/src/assets/i18n/creator/de.json +++ b/src/assets/i18n/creator/de.json @@ -191,7 +191,9 @@ "edit-bookmark-reset": "Markierung zurücksetzen", "grammar-check": "Rechtschreibprüfung", "show-comment-with-filter": "Vulgäre Wörter ausixen", - "show-comment-without-filter": "Vulgäre Wörter anzeigen" + "show-comment-without-filter": "Vulgäre Wörter anzeigen", + "upvote": "positiv", + "downvote": "negativ" }, "content": { "abort": "Abbrechen", diff --git a/src/assets/i18n/creator/en.json b/src/assets/i18n/creator/en.json index daf3b2b01ccd8c656eb5c60ebfcf6fd0877faa80..043d459911792a0c84af47b5aeb1c1064897c211 100644 --- a/src/assets/i18n/creator/en.json +++ b/src/assets/i18n/creator/en.json @@ -192,7 +192,9 @@ "edit-bookmark-reset": "Remove marker", "grammar-check": "Spell check", "show-comment-with-filter": "Hide vulgar words", - "show-comment-without-filter": "Show vulgar words" + "show-comment-without-filter": "Show vulgar words", + "upvote": "upvotes", + "downvote": "downvotes" }, "content": { "abort": "Abort", diff --git a/src/assets/i18n/participant/de.json b/src/assets/i18n/participant/de.json index 7a63a6d40d38729a87658bfe6c909e0577f83927..8bd491462b4c2eaf35ecce7d00ab04f80dc181cb 100644 --- a/src/assets/i18n/participant/de.json +++ b/src/assets/i18n/participant/de.json @@ -158,7 +158,9 @@ "show-more": "Mehr ansehen", "show-less": "Weniger anzeigen", "sure": "Bist du sicher?", - "grammar-check": "Rechtschreibprüfung" + "grammar-check": "Rechtschreibprüfung", + "upvote": "positiv", + "downvote": "negativ" }, "home-page": { "exactly-8": "Ein Raum-Code hat genau 8 Ziffern.", diff --git a/src/assets/i18n/participant/en.json b/src/assets/i18n/participant/en.json index 936d67e96a4ad67b62cf64b3f28780cc7e910aa2..54c36344bc910ff43a4e76be068facc2bcc054f7 100644 --- a/src/assets/i18n/participant/en.json +++ b/src/assets/i18n/participant/en.json @@ -167,7 +167,9 @@ "show-more": "Show more", "show-less": "Show less", "delete": "Delete question", - "grammar-check": "Spell check" + "grammar-check": "Spell check", + "upvote": "upvotes", + "downvote": "downvotes" }, "home-page": { "exactly-8": "A key is a combination of 8 digits.",