Skip to content

Commit 8e530a3

Browse files
committed
filter current user email
1 parent 3b11f03 commit 8e530a3

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

components/gmail/gmail.app.mjs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,18 @@ export default {
310310
const bcc = repliedMessage.payload.headers.find(({ name }) => name.toLowerCase() === "bcc");
311311
opts.to = from.value.split(",");
312312
opts.to.push(...to.value.split(","));
313+
314+
// Filter out the current user's email address
315+
const currentUserEmail = email.toLowerCase().trim();
316+
opts.to = opts.to.filter((addr) => {
317+
// Extract email from possible format like "Name <[email protected]>"
318+
const match = addr.match(/<(.+?)>/) || [
319+
null,
320+
addr.trim(),
321+
];
322+
return match[1].toLowerCase() !== currentUserEmail;
323+
});
324+
313325
opts.to = [
314326
...new Set(opts.to),
315327
];

0 commit comments

Comments
 (0)