Skip to content

Commit

Permalink
Merge pull request #23471 from frappe/version-13-hotfix
Browse files Browse the repository at this point in the history
chore: release v13
  • Loading branch information
ankush committed Nov 28, 2023
2 parents 5bc0353 + 799c0a4 commit 6cd1ea5
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions frappe/email/doctype/newsletter/newsletter.py
Expand Up @@ -248,7 +248,7 @@ def subscribe(email, email_group=None):
"""API endpoint to subscribe an email to a particular email group. Triggers a confirmation email."""

if email_group is None:
email_group = _("Website")
email_group = get_default_email_group()

# build subscription confirmation URL
api_endpoint = frappe.utils.get_url(
Expand Down Expand Up @@ -292,13 +292,16 @@ def subscribe(email, email_group=None):


@frappe.whitelist(allow_guest=True)
def confirm_subscription(email, email_group=_("Website")):
def confirm_subscription(email, email_group=None):
"""API endpoint to confirm email subscription.
This endpoint is called when user clicks on the link sent to their mail.
"""
if not verify_request():
return

if email_group is None:
email_group = get_default_email_group()

if not frappe.db.exists("Email Group", email_group):
frappe.get_doc({"doctype": "Email Group", "title": email_group}).insert(ignore_permissions=True)

Expand Down Expand Up @@ -386,3 +389,7 @@ def send_scheduled_email():

if not frappe.flags.in_test:
frappe.db.commit()


def get_default_email_group():
return _("Website", lang=frappe.db.get_default("language"))

0 comments on commit 6cd1ea5

Please sign in to comment.