-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1722 from cisagov/za/1411-make-statuses-more-mean…
…ingful (On getgov-backup) Ticket #1411: make statuses more meaningful
- Loading branch information
Showing
8 changed files
with
451 additions
and
257 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -140,6 +140,24 @@ class State(models.TextChoices): | |
# previously existed but has been deleted from the registry | ||
DELETED = "deleted", "Deleted" | ||
|
||
@classmethod | ||
def get_help_text(cls, state) -> str: | ||
"""Returns a help message for a desired state. If none is found, an empty string is returned""" | ||
help_texts = { | ||
# For now, unknown has the same message as DNS_NEEDED | ||
cls.UNKNOWN: ("Before this domain can be used, " "you’ll need to add name server addresses."), | ||
cls.DNS_NEEDED: ("Before this domain can be used, " "you’ll need to add name server addresses."), | ||
cls.READY: "This domain has name servers and is ready for use.", | ||
cls.ON_HOLD: ( | ||
"This domain is administratively paused, " | ||
"so it can’t be edited and won’t resolve in DNS. " | ||
"Contact [email protected] for details." | ||
), | ||
cls.DELETED: ("This domain has been removed and " "is no longer registered to your organization."), | ||
} | ||
|
||
return help_texts.get(state, "") | ||
|
||
class Cache(property): | ||
""" | ||
Python descriptor to turn class methods into properties. | ||
|
@@ -1398,6 +1416,21 @@ def dns_needed(self): | |
logger.info("Changing to DNS_NEEDED state") | ||
logger.info("able to transition to DNS_NEEDED state") | ||
|
||
def get_state_help_text(self) -> str: | ||
"""Returns a str containing additional information about a given state. | ||
Returns custom content for when the domain itself is expired.""" | ||
|
||
if self.is_expired() and self.state != self.State.UNKNOWN: | ||
# Given expired is not a physical state, but it is displayed as such, | ||
# We need custom logic to determine this message. | ||
help_text = ( | ||
"This domain has expired, but it is still online. " "To renew this domain, contact [email protected]." | ||
) | ||
else: | ||
help_text = Domain.State.get_help_text(self.state) | ||
|
||
return help_text | ||
|
||
def _disclose_fields(self, contact: PublicContact): | ||
"""creates a disclose object that can be added to a contact Create using | ||
.disclose= <this function> on the command before sending. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.