diff --git a/api/src/app/services/comment.service.ts b/api/src/app/services/comment.service.ts
index d47ce0a..8113af9 100644
--- a/api/src/app/services/comment.service.ts
+++ b/api/src/app/services/comment.service.ts
@@ -4,7 +4,7 @@
* @author Naomi Carrigan
*/
-import { Comment, CreateCommentDto } from "@library/shared-types";
+import { Comment, CreateCommentDto, PrimaryBadge } from "@library/shared-types";
import { prisma } from "../lib/prisma";
import createDOMPurify from "dompurify";
import { JSDOM } from "jsdom";
@@ -65,6 +65,7 @@ export class CommentService {
id: comment.user.id,
username: comment.user.username,
avatar: comment.user.avatar || undefined,
+ primaryBadge: (comment.user.primaryBadge as PrimaryBadge) || undefined,
inDiscord: comment.user.inDiscord,
isVip: comment.user.isVip,
isMod: comment.user.isMod,
diff --git a/apps/frontend/src/app/components/comment-display/comment-display.component.ts b/apps/frontend/src/app/components/comment-display/comment-display.component.ts
index 4a9f3dd..5008691 100644
--- a/apps/frontend/src/app/components/comment-display/comment-display.component.ts
+++ b/apps/frontend/src/app/components/comment-display/comment-display.component.ts
@@ -7,6 +7,7 @@ import { Component, Input, Output, EventEmitter, signal, inject } from '@angular
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import type { Comment } from '@library/shared-types';
+import { PrimaryBadge } from '@library/shared-types';
import { AuthService } from '../../services/auth.service';
import { SanitizeService } from '../../services/sanitize.service';
import { ReportModalComponent } from '../report-modal/report-modal.component';
@@ -25,17 +26,34 @@ import { ReportModalComponent } from '../report-modal/report-modal.component';
}
- @if (comment.user.inDiscord) {
- Discord
- }
- @if (comment.user.isVip) {
- VIP
- }
- @if (comment.user.isMod) {
- Mod
- }
- @if (comment.user.isStaff) {
- Staff
+ @if (comment.user.primaryBadge) {
+
+ @if (comment.user.primaryBadge === PrimaryBadge.STAFF && comment.user.isStaff) {
+ Staff
+ }
+ @if (comment.user.primaryBadge === PrimaryBadge.MOD && comment.user.isMod) {
+ Mod
+ }
+ @if (comment.user.primaryBadge === PrimaryBadge.VIP && comment.user.isVip) {
+ VIP
+ }
+ @if (comment.user.primaryBadge === PrimaryBadge.DISCORD && comment.user.inDiscord) {
+ Discord
+ }
+ } @else {
+
+ @if (comment.user.isStaff) {
+ Staff
+ }
+ @if (comment.user.isMod) {
+ Mod
+ }
+ @if (comment.user.isVip) {
+ VIP
+ }
+ @if (comment.user.inDiscord) {
+ Discord
+ }
}
@if (canEditComment(comment)) {
@@ -244,6 +262,9 @@ export class CommentDisplayComponent {
private readonly authService = inject(AuthService);
readonly sanitizeService = inject(SanitizeService);
+ // Expose PrimaryBadge enum for template
+ readonly PrimaryBadge = PrimaryBadge;
+
@Input({ required: true }) comments = signal([]);
@Output() edit = new EventEmitter<{ commentId: string; content: string }>();
@Output() delete = new EventEmitter();
diff --git a/shared-types/src/lib/comment.types.ts b/shared-types/src/lib/comment.types.ts
index 1f80e21..212e2ed 100644
--- a/shared-types/src/lib/comment.types.ts
+++ b/shared-types/src/lib/comment.types.ts
@@ -4,14 +4,17 @@
* @author Naomi Carrigan
*/
+import { PrimaryBadge } from "./auth.types";
+
interface CommentUser {
- id: string;
- username: string;
- avatar?: string;
- inDiscord?: boolean;
- isVip?: boolean;
- isMod?: boolean;
- isStaff?: boolean;
+ id: string;
+ username: string;
+ avatar?: string;
+ primaryBadge?: PrimaryBadge;
+ inDiscord?: boolean;
+ isVip?: boolean;
+ isMod?: boolean;
+ isStaff?: boolean;
}
interface Comment {