From 706c47cc66c0edc79d6af37311f48dbd4260dba0 Mon Sep 17 00:00:00 2001 From: Sakura Akeno Isayeki Date: Sun, 1 Sep 2024 15:17:18 +0200 Subject: [PATCH] fix(post): Fix missing CS Ticket ID attribution The code changes in this commit fix an issue where the support ticket ID was not being attributed correctly to a post. The commit adds logic to retrieve the ticket ID from the form controls and assigns it to the post's supportTicketStatus property. This ensures that the post is associated with the correct support ticket. --- WowsKarma.Api/Services/Posts/PostService.cs | 1 + WowsKarma.Common/Models/DTOs/PlayerPostDTO.cs | 2 +- .../src/app/shared/modals/post-editor/post-editor.component.ts | 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/WowsKarma.Api/Services/Posts/PostService.cs b/WowsKarma.Api/Services/Posts/PostService.cs index b35e6b4..f6ae235 100644 --- a/WowsKarma.Api/Services/Posts/PostService.cs +++ b/WowsKarma.Api/Services/Posts/PostService.cs @@ -177,6 +177,7 @@ public async Task EditPostAsync(Guid id, PlayerPostDTO edited, bool modEditLock current.Flairs = edited.Flairs; current.UpdatedAt = DateTimeOffset.UtcNow; // Forcing UpdatedAt refresh current.ReadOnly = current.ReadOnly || modEditLock; + current.CustomerSupportTicketId = edited.SupportTicketStatus.TicketId; KarmaService.UpdatePlayerKarma(player, current.ParsedFlairs, previousFlairs, current.NegativeKarmaAble); KarmaService.UpdatePlayerRatings(player, current.ParsedFlairs, previousFlairs); diff --git a/WowsKarma.Common/Models/DTOs/PlayerPostDTO.cs b/WowsKarma.Common/Models/DTOs/PlayerPostDTO.cs index 489f5c8..5c337f8 100644 --- a/WowsKarma.Common/Models/DTOs/PlayerPostDTO.cs +++ b/WowsKarma.Common/Models/DTOs/PlayerPostDTO.cs @@ -35,7 +35,7 @@ public record PlayerPostDTO /// /// Defines the status of the Customer Support ticket associated with the post when applicable. /// - public struct CustomerSupportStatus + public readonly struct CustomerSupportStatus { /// /// Whether the post has an associated Customer Support ticket. diff --git a/wowskarma.app/src/app/shared/modals/post-editor/post-editor.component.ts b/wowskarma.app/src/app/shared/modals/post-editor/post-editor.component.ts index d8f5590..ea7067a 100644 --- a/wowskarma.app/src/app/shared/modals/post-editor/post-editor.component.ts +++ b/wowskarma.app/src/app/shared/modals/post-editor/post-editor.component.ts @@ -106,6 +106,9 @@ export class PostEditorComponent { this.post.replayFile = this.form.controls.replayFile.value; } + const ticketId = this.form.controls.supportTicketStatus.controls.ticketId.value; + this.post.supportTicketStatus = { hasTicket: !!ticketId, ticketId }; + if (create) { // Create the body as a form data