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 4 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
3 changes: 2 additions & 1 deletion apps/tup-cms/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ COPY . /code/
RUN npx nx build tup-ui
RUN npx nx build tup-cms-react

FROM taccwma/core-cms:v4.9.0
# https://github.com/TACC/Core-CMS/pull/826
FROM taccwma/core-cms:ffc1843a

WORKDIR /code

Expand Down
1 change: 1 addition & 0 deletions apps/tup-cms/docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ services:
- ./src/taccsite_cms/settings_custom.py:/code/taccsite_cms/settings_custom.py
- ./src/taccsite_cms/settings_local.py:/code/taccsite_cms/settings_local.py
- ./src/taccsite_cms/secrets.py:/code/taccsite_cms/secrets.py
- ./src/taccsite_cms/apps/email_management/assets:/code/taccsite_cms/apps/email_management/assets
wesleyboar marked this conversation as resolved.
Show resolved Hide resolved
- ../../dist/apps/tup-ui/imports.html:/code/taccsite_cms/templates/imports.html
- ../../apps/tup-ui/src/assets:/code/taccsite_cms/static/src/assets
- ../../dist/apps/tup-cms-react/assets:/code/taccsite_cms/static/cms-react/assets
Expand Down
26 changes: 0 additions & 26 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,35 +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 = """
<p>Greetings,</p>
<p>
You have successfully submitted a form on the TACC website. Thank you for your submission.
</p>
<p>
Business hours are Monday - Friday, 8AM to 5PM Central. We will respond to your submission
according to the information provided on the form webpage.
</p>
<p>
Sincerely,<br>
TACC Communications
</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
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<p>Greetings,</p>
<p>
You have successfully submitted a form on the TACC website. Thank you for your
submission.
</p>
<p>
Business hours are Monday - Friday, 8AM to 5PM Central. We will respond to
your submission according to the information provided on the form webpage.
</p>
<p>
Sincerely,<br />
TACC Communications
</p>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Greetings,

You have successfully submitted a form on the {site_name} website. Thank you for your submission.

Business hours are Monday - Friday, 8AM to 5PM Central. We will respond to your submission according to the information provided on the form webpage.

Sincerely,
{site_name} Communications
Loading