-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve logic in Idv::UspsMail#mail_spammed?
**Why**: If the `max_mail_events` Figaro key is not set on the server, or if it's set to zero, and if the user has not requested any letters, `max_events?` will return `true`, which will then cause `updated_within_last_month?` to throw a NoMethod error because it can't call `update_at` on a nil object. **How**: - Return `false` early in `mail_spammed?` if the user has not requested any letters. - Add `max_mail_events` and `max_mail_events_window_in_days` to the list of required Figaro keys. - Set `max_mail_events` to 2 in the test environment to avoid creating more entries in the DB than is necessary. - Use `#size` instead of `#count` for performance reasons.
- Loading branch information
Showing
5 changed files
with
36 additions
and
35 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
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