[fix] merge fixes and test
This commit is contained in:
parent
8a91f1a790
commit
da95b484db
4 changed files with 5 additions and 5 deletions
|
|
@ -108,7 +108,7 @@ class TestEmailAccount(unittest.TestCase):
|
|||
def test_sendmail(self):
|
||||
frappe.flags.sent_mail = None
|
||||
frappe.sendmail(sender="test_sender@example.com", recipients="test_recipient@example.com",
|
||||
content="test mail 001", subject="test-mail-001")
|
||||
content="test mail 001", subject="test-mail-001", delayed=False)
|
||||
|
||||
sent_mail = email.message_from_string(frappe.flags.sent_mail)
|
||||
self.assertTrue("test-mail-001" in sent_mail.get("Subject"))
|
||||
|
|
|
|||
|
|
@ -338,4 +338,4 @@ def clear_outbox():
|
|||
def prevent_bulk_email_delete(doc, method):
|
||||
from frappe.limits import get_limits
|
||||
if frappe.session.user != 'Administrator' and get_limits().get('block_bulk_email_delete'):
|
||||
frappe.throw(_('Only Administrator can delete Bulk Email'))
|
||||
frappe.throw(_('Only Administrator can delete Email Queue'))
|
||||
|
|
@ -99,7 +99,7 @@ doc_events = {
|
|||
"User": {
|
||||
"validate": "frappe.utils.user.validate_user_limit"
|
||||
},
|
||||
"Bulk Email": {
|
||||
"Email Queue": {
|
||||
"on_trash": "frappe.email.bulk.prevent_bulk_email_delete"
|
||||
},
|
||||
"*": {
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ def check_if_expired():
|
|||
# if expired, stop user from logging in
|
||||
expires_on = formatdate(get_limits().get("expiry"))
|
||||
support_email = get_limits().get("support_email") or _("your provider")
|
||||
|
||||
|
||||
frappe.throw(_("""Your subscription expired on {0}.
|
||||
To extend please send an email to {1}""").format(expires_on, support_email),
|
||||
SiteExpiredError)
|
||||
|
|
@ -72,7 +72,7 @@ def get_expiry_message():
|
|||
def get_limits():
|
||||
limits = frappe.get_conf().get("limits") or {}
|
||||
day = frappe.utils.add_months(frappe.utils.today(), -1)
|
||||
limits["bulk_count"] = frappe.db.count("Bulk Email", filters={'creation': ['>', day]})
|
||||
limits["bulk_count"] = frappe.db.count("Email Queue", filters={'creation': ['>', day]})
|
||||
return limits
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue