-
Notifications
You must be signed in to change notification settings - Fork 184
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
MPP-3753: Disable DomainAddress address field updates #4519
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -686,6 +686,14 @@ class DomainAddrNeedSubdomainException(CannotMakeAddressException): | |||||
status_code = 400 | ||||||
|
||||||
|
||||||
class DomainAddrUpdateException(CannotMakeAddressException): | ||||||
"""Exception raised when attempting to edit an existing domain address field.""" | ||||||
|
||||||
default_code = "address_exists" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
The previous error code makes it confusing to another error where the domain address cannot be created because an address exists. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Addressed these changes, 08417ec |
||||||
default_detail = "You cannot edit an existing domain address field." | ||||||
status_code = 400 | ||||||
|
||||||
|
||||||
class DomainAddrUnavailableException(CannotMakeAddressException): | ||||||
default_code = "address_unavailable" | ||||||
default_detail_template = ( | ||||||
|
@@ -936,6 +944,12 @@ def save( | |||||
incr_if_enabled("domainaddress.create") | ||||||
if self.first_emailed_at: | ||||||
incr_if_enabled("domainaddress.create_via_email") | ||||||
else: | ||||||
# The model is in an update state, do not allow 'address' field updates | ||||||
existing_instance = DomainAddress.objects.get(id=self.id) | ||||||
if existing_instance.address != self.address: | ||||||
raise DomainAddrUpdateException() | ||||||
|
||||||
if not user_profile.has_premium and self.block_list_emails: | ||||||
self.block_list_emails = False | ||||||
if update_fields: | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 on tests!