diff --git a/src/app/components/shared/_dialogs/create-comment/create-comment.component.ts b/src/app/components/shared/_dialogs/create-comment/create-comment.component.ts index 62f54c8aa1c51ef248f2d440fa4ed1a0dd4fa259..f48f539b34918b74c128cf724318cc5965c8a855 100644 --- a/src/app/components/shared/_dialogs/create-comment/create-comment.component.ts +++ b/src/app/components/shared/_dialogs/create-comment/create-comment.component.ts @@ -56,7 +56,7 @@ export class CreateCommentComponent implements OnInit { const comment = new Comment(); comment.roomId = localStorage.getItem(`roomId`); comment.body = body; - comment.userId = this.user.id; + comment.creatorId = this.user.id; comment.createdFromLecturer = this.user.role === 1; this.dialogRef.close(comment); } diff --git a/src/app/components/shared/comment-list/comment-list.component.ts b/src/app/components/shared/comment-list/comment-list.component.ts index 45bf1a4bc90443258026753bf51968a52d9e2c24..ee51099102650c28e50b1a45203fe49f5e7fbf75 100644 --- a/src/app/components/shared/comment-list/comment-list.component.ts +++ b/src/app/components/shared/comment-list/comment-list.component.ts @@ -194,6 +194,12 @@ export class CommentListComponent implements OnInit { break; case this.favorite: this.comments[i].favorite = <boolean>value; + console.log(this.comments[i]); + if (this.user.id === this.comments[i].creatorId && <boolean>value) { + this.translateService.get('comment-list.comment-got-favorited').subscribe( msg => { + this.notificationService.show(msg); + }); + } break; case 'score': this.comments[i].score = <number>value; diff --git a/src/app/models/comment.ts b/src/app/models/comment.ts index 51308497b63173c3fd82e5b424ddec59f65f36d1..22062ef8c5a170d517121d00b29003c1213e1d28 100644 --- a/src/app/models/comment.ts +++ b/src/app/models/comment.ts @@ -3,7 +3,7 @@ import { CorrectWrong } from './correct-wrong.enum'; export class Comment { id: string; roomId: string; - userId: string; + creatorId: string; revision: string; body: string; read: boolean; @@ -16,7 +16,7 @@ export class Comment { ack: boolean; constructor(roomId: string = '', - userId: string = '', + creatorId: string = '', body: string = '', read: boolean = false, correct: CorrectWrong = CorrectWrong.NULL, @@ -28,7 +28,7 @@ export class Comment { ack: boolean = true) { this.id = ''; this.roomId = roomId; - this.userId = userId; + this.creatorId = creatorId; this.revision = ''; this.body = body; this.read = read; diff --git a/src/app/services/websockets/ws-comment-service.service.ts b/src/app/services/websockets/ws-comment-service.service.ts index 8694fe84b68c9f2452cdc89fe267f5f7aac03f6d..4333dc7417abfb1793f47a7b1a346fbda628513c 100644 --- a/src/app/services/websockets/ws-comment-service.service.ts +++ b/src/app/services/websockets/ws-comment-service.service.ts @@ -20,7 +20,7 @@ export class WsCommentServiceService { constructor(private wsConnector: WsConnectorService) { } add(comment: Comment): void { - const message = new CreateComment(comment.roomId, comment.userId, comment.body); + const message = new CreateComment(comment.roomId, comment.creatorId, comment.body); this.wsConnector.send(`/queue/comment.command.create`, JSON.stringify(message)); } diff --git a/src/assets/i18n/participant/de.json b/src/assets/i18n/participant/de.json index 475be570c0c8afd7c08e04cb91fd0fd0c06f8cd7..cad6ca12b0780ad74910ed3f728b144da0a2f81a 100644 --- a/src/assets/i18n/participant/de.json +++ b/src/assets/i18n/participant/de.json @@ -28,6 +28,7 @@ "add-comment": "Stell deine Frage!", "pause-comments": "Pausiere den Fragen-Stream", "play-comments": "Starte den Fragen-Stream", + "comment-got-favorited": "Eine Frage von dir wurde favorisiert!", "comment-stream-stopped": "Der Fragen-Stream wurde gestoppt.", "comment-stream-started": "Der Fragen-Stream wurde gestartet.", "comment-sent": "Die Frage wurde veröffentlicht.", diff --git a/src/assets/i18n/participant/en.json b/src/assets/i18n/participant/en.json index bd5132264bf36261ef94a6fb4ef82057c140b992..cd14fcfe3172c88dd8d2582e313caefb8bd9ab4d 100644 --- a/src/assets/i18n/participant/en.json +++ b/src/assets/i18n/participant/en.json @@ -28,6 +28,7 @@ "add-comment": "Ask a question!", "pause-comments": "Pause the question stream", "play-comments": "Start the question stream", + "comment-got-favorited": "A question of yours got favorited!", "comment-stream-stopped": "Question stream has been stopped.", "comment-stream-started": "Question stream has been started.", "comment-sent": "The question has been published.",