Prevented sending of empty emails
This commit is contained in:
parent
9a0d73ec97
commit
71e4b3399d
@ -285,8 +285,10 @@ class ObservationsController {
|
|||||||
logger.info("Sending Observation data by email")
|
logger.info("Sending Observation data by email")
|
||||||
if (::mailer.isInitialized) {
|
if (::mailer.isInitialized) {
|
||||||
val data = getObservations(observationsRequest)
|
val data = getObservations(observationsRequest)
|
||||||
if (data.isEmpty())
|
if (data.isEmpty()) {
|
||||||
|
logger.warn("Email not send, would contain no data")
|
||||||
throw ResponseStatusException(HttpStatus.BAD_REQUEST, "Request would send no data.")
|
throw ResponseStatusException(HttpStatus.BAD_REQUEST, "Request would send no data.")
|
||||||
|
}
|
||||||
mailer.sendObservationData(data)
|
mailer.sendObservationData(data)
|
||||||
return true
|
return true
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user