Disabling 'Enable automatic CiviMail recipient count display' setting leads to 'Unknown error'
Overview
This bug prevents us to disable the 'Enable automatic CiviMail recipient count display' and eventually the button to refresh the recipient count in 'New Mailing' doesn't show up due to an internal error.
Reproduction steps
- Go to Mail Component Settings
- Disable the 'Enable automatic CiviMail recipient count display' setting
- Go to 'New Mailing' screen. As per the setting, the 'Refresh recipient count' should appear.
Current behaviour
The 'Refresh recipient count' shouldn't appear. The console
Possibly unhandled rejection: {"error_message":"Unknown error.","is_error":1}
Expected behaviour
The 'Refresh recipient count should appear.
Environment information
Tested on https://dmaster.demo.civicrm.org/
Comments
The source of the error is in this line here. As a result when an api.getValue returns 'false' value, it generates an error response instead of returning the false value. This affected the CiviMail compose screen, where after setting 'auto_recipient_rebuild' to false, the getvalue api here return false value and eventually translated into an error message, which is wrong.