Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: CMD-112 custom confirmation e-mail via setting #448

Draft
wants to merge 16 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/tup-cms/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ COPY . /code/
RUN npx nx build tup-ui
RUN npx nx build tup-cms-react

FROM taccwma/core-cms:v4.10.2
FROM taccwma/core-cms:v4.10.2-extra.1

WORKDIR /code

Expand Down
29 changes: 0 additions & 29 deletions apps/tup-cms/src/apps/portal/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from django.dispatch import receiver
from djangocms_forms.signals import form_submission
from django.conf import settings
from django.core.mail import send_mail


logger = logging.getLogger(f"portal.{__name__}")
Expand Down Expand Up @@ -43,38 +42,10 @@ def submit_ticket(form_data):
requests.post(f"{service_url}/tickets/noauth", data=ticket_data, files=[])


def send_confirmation_email(form_name, form_data):
email_body = f"""
<p>Greetings,</p>
<p>
Thank you for reaching out to TACC and completing the {form_name}.
</p>
<p>
<ul>
<li>For training registration requests, you will be contacted within one week to confirm registration. For additional help please contact Lauren Bruce ([email protected]).</li>
<li>For tour requests, a tour coordinator will contact you within two business days to complete your reservation. For additional assistance please reach out to [email protected].</li>
<li>For all other issues, a TACC support person will be in contact shortly. For additional assistance please reach out to [email protected].</li>
</ul>
</p>
<p>
Thank you for your time,<br>
TACC Support
</p>
"""
send_mail(
f"TACC Form Submission Received: {form_name}",
email_body,
"[email protected]",
[form_data["email"]],
html_message=email_body)


def callback(form, cleaned_data, **kwargs):
logger.debug(f"received submission from {form.name}")
if form.name == 'rt-ticket-form':
submit_ticket(cleaned_data)
elif ('email' in cleaned_data):
send_confirmation_email(form.name, cleaned_data)
Comment on lines 47 to -77
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

REGRESSION BUG: Yes, Core-CMS will send_confirmation_email instead. But TACC should not send_confirmation_email if ticket is an rt-ticket-form. Core-CMS does not know this, so TACC will send_confirmation_email for rt-ticket-form.



class PortalConfig(AppConfig):
Expand Down
35 changes: 35 additions & 0 deletions apps/tup-cms/src/taccsite_cms/settings_custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,41 @@

TACC_SOCIAL_SHARE_PLATFORMS = ['linkedin', 'facebook', 'email']

########################
# TACC: EMAIL
########################

PORTAL_SHOULD_SEND_CONF_EMAIL = True
PORTAL_CONF_EMAIL_TEXT = """
Greetings,

Thank you for reaching out to TACC and completing the {form_name}.

- For training registration requests, you will be contacted within one week to confirm registration. For additional help please contact Lauren Bruce ([email protected]).
- For tour requests, a tour coordinator will contact you within two business days to complete your reservation. For additional assistance please reach out to [email protected].
- For all other issues, a TACC support person will be in contact shortly. For additional assistance please reach out to [email protected].

Thank you for your time,
TACC Support
"""
PORTAL_CONF_EMAIL_HTML = """
<p>Greetings,</p>
<p>
Thank you for reaching out to TACC and completing the {form_name}.
</p>
<p>
<ul>
<li>For training registration requests, you will be contacted within one week to confirm registration. For additional help please contact Lauren Bruce (<a href="mailto:[email protected]">[email protected]</a>).</li>
<li>For tour requests, a tour coordinator will contact you within two business days to complete your reservation. For additional assistance please reach out to <a href="mailto:[email protected]">[email protected]</a>.</li>
<li>For all other issues, a TACC support person will be in contact shortly. For additional assistance please reach out to <a href="mailto:[email protected]">[email protected]</a>.</li>
</ul>
</p>
<p>
Thank you for your time,<br>
TACC Support
</p>
"""

########################
# DJANGOCMS_BLOG
########################
Expand Down
Loading