Skip to content

Commit eaa3417

Browse files
authored
Merge pull request #1189 from JulianAdams4/spam
Fix incoming spam emails
2 parents ace8164 + 5d86d8c commit eaa3417

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

email_mailbox/src/utils/electronEventInterface.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -414,17 +414,19 @@ const handleNewMessageEvent = async ({ rowid, params }) => {
414414
: undefined
415415
: senderDeviceId;
416416
const [prevEmail] = await getEmailByKey(metadataKey);
417-
const contactObjectSpamToCheck = parseContactRow(from);
418-
const contactSpamToCheck = await getContactByEmails([
419-
contactObjectSpamToCheck.email
420-
]);
421-
const isContactSpamer = contactSpamToCheck[0]
422-
? contactSpamToCheck[0].spamScore > 1
423-
: false;
424-
const isSpam =
425-
labels && !isContactSpamer
426-
? !!labels.find(label => label === LabelType.spam.text)
427-
: isContactSpamer;
417+
418+
let isSpam = false;
419+
if (labels && !!labels.find(label => label === LabelType.spam.text)) {
420+
isSpam = true;
421+
} else {
422+
const contactObjectSpamToCheck = parseContactRow(from);
423+
const contactSpamToCheck = await getContactByEmails([
424+
contactObjectSpamToCheck.email
425+
]);
426+
isSpam = contactSpamToCheck[0]
427+
? contactSpamToCheck[0].spamScore > 1
428+
: false;
429+
}
428430
const InboxLabelId = LabelType.inbox.id;
429431
const SentLabelId = LabelType.sent.id;
430432
const SpamLabelId = LabelType.spam.id;

0 commit comments

Comments
 (0)