mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-13 04:59:59 +02:00
Minor refactor fo update notification and formatting changes
This commit is contained in:
parent
5dbc356d71
commit
ccbefe209c
2 changed files with 15 additions and 10 deletions
|
@ -1,6 +1,8 @@
|
||||||
|
{% autoescape off %}{# In a text file, we don't want to have HTML entities escaped #}
|
||||||
|
|
||||||
Hi,
|
Hi,
|
||||||
An update was made to a domain you manage.
|
An update was made to a domain you manage.
|
||||||
DOMAIN: {{domain.gov}}
|
DOMAIN: {{domain}}
|
||||||
UPDATED BY: {{user}}
|
UPDATED BY: {{user}}
|
||||||
UPDATED ON: {{date}}
|
UPDATED ON: {{date}}
|
||||||
INFORMATION UPDATED: {{changes}}
|
INFORMATION UPDATED: {{changes}}
|
||||||
|
@ -11,7 +13,7 @@ Get help with managing your .gov domain <https://get.gov/help/domain-management/
|
||||||
|
|
||||||
----------------------------------------------------------------
|
----------------------------------------------------------------
|
||||||
WHY DID YOU RECEIVE THIS EMAIL?
|
WHY DID YOU RECEIVE THIS EMAIL?
|
||||||
You’re listed as a domain manager for $domain.gov, so you’ll receive a notification whenever changes are made to that domain.
|
You’re listed as a domain manager for {{domain}}, so you’ll receive a notification whenever changes are made to that domain.
|
||||||
If you have questions or concerns, reach out to the person who made the change or reply to this email.
|
If you have questions or concerns, reach out to the person who made the change or reply to this email.
|
||||||
|
|
||||||
THANK YOU
|
THANK YOU
|
||||||
|
@ -20,4 +22,5 @@ THANK YOU
|
||||||
----------------------------------------------------------------
|
----------------------------------------------------------------
|
||||||
The .gov team
|
The .gov team
|
||||||
Contact us <https://get.gov/contact/>
|
Contact us <https://get.gov/contact/>
|
||||||
Learn about .gov <https://get.gov>
|
Learn about .gov <https://get.gov>
|
||||||
|
{% endautoescape %}
|
|
@ -149,11 +149,12 @@ class DomainFormBaseView(DomainBaseView, FormMixin):
|
||||||
|
|
||||||
return current_domain_info
|
return current_domain_info
|
||||||
|
|
||||||
def send_update_notification(self, form):
|
def send_update_notification(self, form, force_send=False):
|
||||||
"""Send a notification to all domain managers that an update has occured
|
"""Send a notification to all domain managers that an update has occured
|
||||||
for a single domain. Uses update_to_approved_domain.txt template.
|
for a single domain. Uses update_to_approved_domain.txt template.
|
||||||
|
|
||||||
Checks for changes, and does nothing if the form has not changed.
|
If there are no changes to the form, emails will NOT be sent unless force_send
|
||||||
|
is set to True.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# send notification email for changes to any of these forms
|
# send notification email for changes to any of these forms
|
||||||
|
@ -172,9 +173,10 @@ class DomainFormBaseView(DomainBaseView, FormMixin):
|
||||||
}
|
}
|
||||||
|
|
||||||
if form.__class__ in form_label_dict:
|
if form.__class__ in form_label_dict:
|
||||||
|
# these types of forms can cause notifications
|
||||||
should_notify=True
|
should_notify=True
|
||||||
if form.__class__ in check_for_portfolio:
|
if form.__class__ in check_for_portfolio:
|
||||||
# check for portfolio
|
# some forms shouldn't cause notifications if they are in a portfolio
|
||||||
info = self.get_domain_info_from_domain()
|
info = self.get_domain_info_from_domain()
|
||||||
if not info or info.portfolio:
|
if not info or info.portfolio:
|
||||||
should_notify = False
|
should_notify = False
|
||||||
|
@ -182,7 +184,7 @@ class DomainFormBaseView(DomainBaseView, FormMixin):
|
||||||
# don't notify for any other types of forms
|
# don't notify for any other types of forms
|
||||||
should_notify=False
|
should_notify=False
|
||||||
|
|
||||||
if should_notify and form.has_changed:
|
if (should_notify and form.has_changed()) or force_send:
|
||||||
logger.info("Sending email to domain managers")
|
logger.info("Sending email to domain managers")
|
||||||
|
|
||||||
context={
|
context={
|
||||||
|
@ -305,10 +307,10 @@ class DomainOrgNameAddressView(DomainFormBaseView):
|
||||||
|
|
||||||
def form_valid(self, form):
|
def form_valid(self, form):
|
||||||
"""The form is valid, save the organization name and mailing address."""
|
"""The form is valid, save the organization name and mailing address."""
|
||||||
form.save()
|
|
||||||
|
|
||||||
self.send_update_notification(form)
|
self.send_update_notification(form)
|
||||||
|
|
||||||
|
form.save()
|
||||||
|
|
||||||
messages.success(self.request, "The organization information for this domain has been updated.")
|
messages.success(self.request, "The organization information for this domain has been updated.")
|
||||||
|
|
||||||
# superclass has the redirect
|
# superclass has the redirect
|
||||||
|
@ -602,7 +604,7 @@ class DomainDNSSECView(DomainFormBaseView):
|
||||||
logger.error(errmsg + ": " + err)
|
logger.error(errmsg + ": " + err)
|
||||||
messages.error(self.request, errmsg)
|
messages.error(self.request, errmsg)
|
||||||
else:
|
else:
|
||||||
self.send_update_notification(form)
|
self.send_update_notification(form, force_send=True)
|
||||||
return self.form_valid(form)
|
return self.form_valid(form)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue