Skip to content

Commit f4b4616

Browse files
potts99pedroramon
andauthored
feat: kanban & command (#448)
* Fix locale for Portuguese (#419) * wrong value for Tagalong locale * improve pt locale --------- Co-authored-by: Jack Andrews <[email protected]> * chore: cleanup * fix: imap email comments not pulling through (#447) * feat: init kanban view * chore: kanban ui improvements * chore: move settings to the right * chore: refactor * feat: more ui improvements to ticket view * fix: some issues * feat: command menu --------- Co-authored-by: Pedro Ramon <[email protected]>
1 parent eec566e commit f4b4616

File tree

22 files changed

+1627
-759
lines changed

22 files changed

+1627
-759
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,6 @@ yarn-error.log*
4141
# Typescript build
4242
dist
4343

44-
infra
44+
infra
45+
46+
.cursorrules

apps/api/src/lib/notifications/issue/status.ts

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
11
import { prisma } from "../../../prisma";
22

3-
/**
4-
* Creates status change notifications for all ticket followers.
5-
*
6-
* @param {object} ticket - The ticket object
7-
* @param {object} updater - The username of the person who updated the status
8-
* @param {string} newStatus - The new status of the ticket
9-
* @returns {Promise<void>}
10-
*/
113
export async function activeStatusNotification(
124
ticket: any,
135
updater: any,
@@ -41,14 +33,6 @@ export async function activeStatusNotification(
4133
}
4234
}
4335

44-
/**
45-
* Creates status change notifications for all ticket followers.
46-
*
47-
* @param {object} ticket - The ticket object
48-
* @param {object} updater - The username of the person who updated the status
49-
* @param {string} newStatus - The new status of the ticket
50-
* @returns {Promise<void>}
51-
*/
5236
export async function statusUpdateNotification(
5337
ticket: any,
5438
updater: any,

apps/api/src/lib/services/imap.service.ts

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,17 +61,31 @@ export class ImapService {
6161
): Promise<void> {
6262
const { from, subject, text, html, textAsHtml } = parsed;
6363

64+
console.log("isReply", isReply);
65+
6466
if (isReply) {
65-
const ticketIdMatch = subject.match(/#(\d+)/);
66-
if (!ticketIdMatch) {
67+
// First try to match UUID format
68+
const uuidMatch = subject.match(
69+
/(?:ref:|#)([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})/i
70+
);
71+
console.log("UUID MATCH", uuidMatch);
72+
73+
const ticketId = uuidMatch?.[1];
74+
75+
console.log("TICKET ID", ticketId);
76+
77+
if (!ticketId) {
6778
throw new Error(`Could not extract ticket ID from subject: ${subject}`);
6879
}
6980

70-
const ticketId = ticketIdMatch[1];
7181
const ticket = await prisma.ticket.findFirst({
72-
where: { Number: Number(ticketId) },
82+
where: {
83+
id: ticketId,
84+
},
7385
});
7486

87+
console.log("TICKET", ticket);
88+
7589
if (!ticket) {
7690
throw new Error(`Ticket not found: ${ticketId}`);
7791
}
@@ -152,7 +166,10 @@ export class ImapService {
152166
msg.on("body", (stream) => {
153167
simpleParser(stream, async (err, parsed) => {
154168
if (err) throw err;
155-
const isReply = parsed.subject?.includes("Re:");
169+
const subjectLower = parsed.subject?.toLowerCase() || "";
170+
const isReply =
171+
subjectLower.includes("re:") ||
172+
subjectLower.includes("ref:");
156173
await this.processEmail(parsed, isReply || false);
157174
});
158175
});

0 commit comments

Comments
 (0)