diff --git a/apps/api/src/controllers/ticket.ts b/apps/api/src/controllers/ticket.ts index a3bc8b7cc..27ec2e573 100644 --- a/apps/api/src/controllers/ticket.ts +++ b/apps/api/src/controllers/ticket.ts @@ -199,6 +199,10 @@ export function ticketRoutes(fastify: FastifyInstance) { }); await sendAssignedEmail(assgined!.email); + + const user = await checkSession(request); + + await assignedNotification(engineer, ticket, user); } const webhook = await prisma.webhooks.findMany({ diff --git a/apps/api/src/prisma/migrations/20241116014522_hold/migration.sql b/apps/api/src/prisma/migrations/20241116014522_hold/migration.sql new file mode 100644 index 000000000..720977a52 --- /dev/null +++ b/apps/api/src/prisma/migrations/20241116014522_hold/migration.sql @@ -0,0 +1,2 @@ +-- AlterEnum +ALTER TYPE "TicketStatus" ADD VALUE 'hold'; diff --git a/apps/api/src/prisma/schema.prisma b/apps/api/src/prisma/schema.prisma index 686f6d6bd..040ed6460 100644 --- a/apps/api/src/prisma/schema.prisma +++ b/apps/api/src/prisma/schema.prisma @@ -417,6 +417,7 @@ enum Hook { } enum TicketStatus { + hold needs_support in_progress in_review diff --git a/apps/client/components/TicketDetails/index.tsx b/apps/client/components/TicketDetails/index.tsx index ba175d9c9..79bf9ce31 100644 --- a/apps/client/components/TicketDetails/index.tsx +++ b/apps/client/components/TicketDetails/index.tsx @@ -64,6 +64,7 @@ import { useUser } from "../../store/session"; import { ClientCombo, IconCombo, UserCombo } from "../Combo"; const ticketStatusMap = [ + { id: 0, value: "hold", name: "Hold", icon: CircleDotDashed }, { id: 1, value: "needs_support", name: "Needs Support", icon: LifeBuoy }, { id: 2, value: "in_progress", name: "In Progress", icon: CircleDotDashed }, { id: 3, value: "in_review", name: "In Review", icon: Loader }, @@ -975,45 +976,46 @@ export default function Ticket() { )} - {data.ticket.following.length > 0 && ( -
- - - - - -
- Followers - {data.ticket.following.map( - (follower: any) => { - const userMatch = users.find( - (user) => - user.id === follower && - user.id !== - data.ticket.assignedTo.id - ); - console.log(userMatch); - return userMatch ? ( -
- {userMatch.name} -
- ) : null; - } - )} + {data.ticket.following && + data.ticket.following.length > 0 && ( +
+ + + + + +
+ Followers + {data.ticket.following.map( + (follower: any) => { + const userMatch = users.find( + (user) => + user.id === follower && + user.id !== + data.ticket.assignedTo.id + ); + console.log(userMatch); + return userMatch ? ( +
+ {userMatch.name} +
+ ) : null; + } + )} - {data.ticket.following.filter( - (follower: any) => - follower !== data.ticket.assignedTo.id - ).length === 0 && ( - - This issue has no followers - - )} -
-
-
-
- )} + {data.ticket.following.filter( + (follower: any) => + follower !== data.ticket.assignedTo.id + ).length === 0 && ( + + This issue has no followers + + )} +
+
+
+
+ )}
@@ -1110,15 +1112,16 @@ export default function Ticket() { {moment(comment.createdAt).format("LLL")} - {comment.user && - comment.userId === user.id && ( - { - deleteComment(comment.id); - }} - /> - )} + {(user.isAdmin || + (comment.user && + comment.userId === user.id)) && ( + { + deleteComment(comment.id); + }} + /> + )}
{comment.text}