Revert "fix: email digest user not found"

This reverts commit 188657d05a.
This commit is contained in:
Suraj Shetty 2021-04-23 14:14:47 +05:30
parent c21ce42559
commit 52ea6b126b

View File

@ -50,8 +50,12 @@ class EmailDigest(Document):
recipients = list(filter(lambda r: r in valid_users,
self.recipient_list.split("\n")))
original_user = frappe.session.user
if recipients:
for user_id in recipients:
frappe.set_user(user_id)
frappe.set_user_lang(user_id)
msg_for_this_recipient = self.get_msg_html()
if msg_for_this_recipient:
frappe.sendmail(
@ -62,6 +66,9 @@ class EmailDigest(Document):
reference_name = self.name,
unsubscribe_message = _("Unsubscribe from this Email Digest"))
frappe.set_user(original_user)
frappe.set_user_lang(original_user)
def get_msg_html(self):
"""Build email digest content"""
frappe.flags.ignore_account_permission = True