Updated AdminPollService to limit end_date (#336).

This commit is contained in:
Clermonté 2018-08-09 15:06:24 +02:00 committed by Liquidsoul
parent 324ac9dfcb
commit 38552da738
No known key found for this signature in database
GPG Key ID: 15983D72D696931D

View File

@ -33,10 +33,20 @@ class AdminPollService {
function updatePoll($poll) {
global $config;
if ($poll->end_date > $poll->creation_date) {
return $this->pollRepository->update($poll);
$end_date = strtotime($poll->end_date);
if ($end_date < strtotime($poll->creation_date)) {
$poll->end_date = $poll->creation_date;
} elseif ($end_date > $this->pollService->maxExpiryDate()) {
$poll->end_date = $this->pollService->maxExpiryDate();
}
return false;
return $this->pollRepository->update($poll);
}
/**