fixed newsletter unsubscribe and default footer

This commit is contained in:
Anand Doshi 2015-03-27 17:42:03 +05:30
parent f977ad036e
commit adcf857c37
2 changed files with 11 additions and 5 deletions

View File

@ -59,7 +59,7 @@ class Newsletter(Document):
subject = self.subject, message = self.message,
reference_doctype = self.doctype, reference_name = self.name,
unsubscribe_method = "/api/method/erpnext.crm.doctype.newsletter.newsletter.unsubscribe",
unsubscribe_params = {"name": self.name})
unsubscribe_params = {"name": self.newsletter_list})
if not frappe.flags.in_test:
frappe.db.auto_commit_on_many_writes = False
@ -85,9 +85,7 @@ def get_lead_options():
@frappe.whitelist(allow_guest=True)
def unsubscribe(email, name):
from frappe.email.bulk import return_unsubscribed_page
from frappe.utils.verified_command import verify_request
if not verify_request():
return
@ -97,8 +95,13 @@ def unsubscribe(email, name):
subscriber.unsubscribed = 1
subscriber.save(ignore_permissions=True)
frappe.db.commit()
return_unsubscribed_page(email)
def return_unsubscribed_page(email):
frappe.respond_as_web_page(_("Unsubscribed"), _("{0} has been successfully unsubscribed from this list.").format(email))
def create_lead(email_id):
"""create a lead if it does not exist"""
from email.utils import parseaddr

View File

@ -90,8 +90,11 @@ scheduler_events = {
]
}
default_mail_footer = """<div style="padding: 7px; text-align: right;">
<a style="color: #888; font-size: 80%;" href="https://erpnext.com">Sent via ERPNext</a></div>"""
default_mail_footer = """<div style="padding: 7px; margin-top: 7px; text-align: center;">
<a style="color: #8D99A6; font-size: 85%; text-decoration: none;" href="https://erpnext.com" target="_blank">
Sent via ERPNext
</a>
</div>"""
get_translated_dict = {
("page", "setup-wizard"): "frappe.geo.country_info.get_translated_dict",