Skip to content

Commit

Permalink
feat(post): add conditional CS Ticket ID display
Browse files Browse the repository at this point in the history
- Updated the HTML template of the post component to improve the display of support tickets.
- Added a condition in the HTML template to show the support ticket ID only if the user is the owner or privileged.
- Changed the tooltip text from "Reported to CS" to "Reported to Customer Support".
- Modified the TypeScript file of the post component to include a computed property `isOwnerOrPrivileged` that checks if the user is the owner or has privileged roles.

This commit improves how support tickets are displayed and provides more accurate information for users.
  • Loading branch information
SakuraIsayeki committed Sep 1, 2024
1 parent a69cb37 commit b84c484
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 2 additions & 2 deletions wowskarma.app/src/app/shared/post/post.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ <h5 class="my-2">{{ p.title }}</h5>
}

@if (p.supportTicketStatus?.hasTicket) {
@if (p.supportTicketStatus?.ticketId) {
@if (p.supportTicketStatus?.ticketId && isOwnerOrPrivileged()) {
<i class="bi bi-flag text-success lead mx-1" ngbTooltip="CS Ticket ID : {{ p.supportTicketStatus!.ticketId }}"></i>
} @else {
<i class="bi bi-flag text-success lead mx-1" ngbTooltip="Reported to CS"></i>
<i class="bi bi-flag text-success lead mx-1" ngbTooltip="Reported to Customer Support"></i>
}
}

Expand Down
8 changes: 7 additions & 1 deletion wowskarma.app/src/app/shared/post/post.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChangeDetectionStrategy, Component, input } from "@angular/core";
import { ChangeDetectionStrategy, Component, computed, input } from "@angular/core";
import { NgbModal } from "@ng-bootstrap/ng-bootstrap";
import { PostModEditorComponent } from 'src/app/shared/modals/post-mod-edit/post-mod-editor.component';
import { PlayerPostDto } from "../../services/api/models/player-post-dto";
Expand All @@ -16,6 +16,12 @@ import { PostModDeleteComponent } from "../modals/post-mod-delete/post-mod-delet
export class PostComponent {
public post = input<PlayerPostDto>();
public postDisplayType = input.required<"neutral" | "received" | "sent">();
public isOwnerOrPrivileged = computed(() =>
this.authService.userInfo$.value?.id === this.post()?.author?.id
|| this.authService.userInfo$.value?.roles?.includes("mod")
|| this.authService.userInfo$.value?.roles?.includes("admin")
|| this.authService.userInfo$.value?.roles?.includes("wg")
);

constructor(public authService: AuthService, private modalService: NgbModal) {
}
Expand Down

0 comments on commit b84c484

Please sign in to comment.