diff --git a/src/app/components/shared/comment/comment.component.html b/src/app/components/shared/comment/comment.component.html index 0bd1627a2cb29871b30e05f34c6bfe9471fd0c49..6899852ec244b15316440aa10c3ce8d0c8a41567 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 159d74af5edc824365a8342a2317bd4600536130..5e543d7ca965230626f95bc5706b4a919446aee8 100644 --- a/src/assets/i18n/creator/de.json +++ b/src/assets/i18n/creator/de.json @@ -192,7 +192,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 c95c108328d843d5243baee9594ca39615ffe50f..4714d563ec951ca976b7a455ba51d79bfb09326c 100644 --- a/src/assets/i18n/creator/en.json +++ b/src/assets/i18n/creator/en.json @@ -193,7 +193,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 4215ee795ff63a06396dd04467d63c74f420b6f9..a0f87e838e32d5bc8b8e8700b282fa526dcc5a31 100644 --- a/src/assets/i18n/participant/de.json +++ b/src/assets/i18n/participant/de.json @@ -159,7 +159,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 9a14a1a67caea608da0a53d310ff5c81c3e55b12..be4675cb8429bd2579225736fcd1a5895101193c 100644 --- a/src/assets/i18n/participant/en.json +++ b/src/assets/i18n/participant/en.json @@ -168,7 +168,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.",