From 2b08d7c348031df9be3ee6165ed8ab0004b9a111 Mon Sep 17 00:00:00 2001 From: Sumit Bhanushali Date: Tue, 14 Jan 2025 12:29:20 +0530 Subject: [PATCH] fix: move ifnull logic to applicaiton for better orm support --- frappe/email/inbox.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frappe/email/inbox.py b/frappe/email/inbox.py index 76396b9e1b..f709f3f8d2 100644 --- a/frappe/email/inbox.py +++ b/frappe/email/inbox.py @@ -55,8 +55,12 @@ def create_email_flag_queue(names, action): for name in json.loads(names or []): uid, seen_status, email_account = frappe.db.get_value( - "Communication", name, ["ifnull(uid, -1)", "ifnull(seen, 0)", "email_account"] + "Communication", name, ["uid", "seen", "email_account"] ) + if not uid: + uid = -1 + if not seen_status: + seen_status = 0 # can not mark email SEEN or UNSEEN without uid if not uid or uid == -1: