mirror of
https://framagit.org/framasoft/framadate/framadate
synced 2026-01-23 02:14:06 +00:00
Check that conditions on valueMax are acceptable before adding the vote
Handles people voting when the answers valueMax has been reached by someone else in the background Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
76b19ee9ba
commit
ff47a21ac2
12 changed files with 76 additions and 1 deletions
|
|
@ -19,6 +19,7 @@
|
|||
use Framadate\Editable;
|
||||
use Framadate\Exception\AlreadyExistsException;
|
||||
use Framadate\Exception\ConcurrentEditionException;
|
||||
use Framadate\Exception\ConcurrentVoteException;
|
||||
use Framadate\Exception\MomentAlreadyExistsException;
|
||||
use Framadate\Message;
|
||||
use Framadate\Security\PasswordHasher;
|
||||
|
|
@ -224,6 +225,8 @@ if (!empty($_POST['save'])) { // Save edition of an old vote
|
|||
}
|
||||
} catch (ConcurrentEditionException $cee) {
|
||||
$message = new Message('danger', __('Error', 'Poll has been updated before you vote'));
|
||||
} catch (ConcurrentVoteException $cve) {
|
||||
$message = new Message('danger', __('Error', "Your vote wasn't counted, because someone voted in the meantime and it conflicted with your choices and the poll conditions. Please retry."));
|
||||
}
|
||||
}
|
||||
} elseif (isset($_POST['save'])) { // Add a new vote
|
||||
|
|
@ -251,6 +254,8 @@ if (!empty($_POST['save'])) { // Save edition of an old vote
|
|||
$message = new Message('danger', __('Error', 'You already voted'));
|
||||
} catch (ConcurrentEditionException $cee) {
|
||||
$message = new Message('danger', __('Error', 'Poll has been updated before you vote'));
|
||||
} catch (ConcurrentVoteException $cve) {
|
||||
$message = new Message('danger', __('Error', "Your vote wasn't counted, because someone voted in the meantime and it conflicted with your choices and the poll conditions. Please retry."));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue