Repository navigation
fix(reports): lock email-only options when mail isn't set up (#141) - #153
Merged
Merged
Conversation
Print inventory's Email it to me and Send it again are disabled, with a lock and the reason under them, when the server has no mail or the account has no address. Owners and admins get Set up email (the docs' Mail page); others are told to ask the owner. The server refuses email: true and report schedules with 409 mail_not_configured or no_email_address instead of accepting them and dropping the mail (D254). Closes #141 Signed-off-by: Ibrahim Roshdy <22573766+ibrahimroshdy@users.noreply.github.com>
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #141.
On a server without mail, Email it to me and Send it again in Print inventory looked like normal options: you could turn them on and nothing ever arrived. Now they're locked and say why, and the server refuses them too.
What a person sees
/admin/notifications/#mail).aria-describedbypoints both at the lock line.How it works
smtpConfiguredfrom the notification settings it already had, plus/mefor the address and the location list for the role. Until the settings load, nothing is locked; the server catches anything sent in that gap. A locked option is never put in the request.POST /api/v1/reports/inventoryand/reports/insurancewithemail: true, andPUT /api/v1/me/report-schedules, now return 409mail_not_configuredwhenKEPT_SMTP_URLis unset, and 409no_email_addresswhen the account has no address it can send to. Before, these were accepted and the mail was dropped. Both codes are new in@kept/shared; the web shows each as one sentence.Audit of other email-only options
Docs and spec
Tested
src/reports/reports.test.tsadds two cases: mail off refusesemail: trueand a schedule while a plain report still runs; an account with no address is refused. The existing mail tests now run with mail configured.test/screens/reports.test.tsxadds six cases: mail on means nothing is locked; mail off as owner shows the lock, the description and the link, and the PDF still runs without email; a member gets "ask the owner"; no address; the server's refusal shown as a sentence; Arabic keeps to logical CSS.ci-local.sh --only lint,typecheck,drift,check-i18n,check-logical-css, the full server suite.