Added canVote() to poll

This commit is contained in:
aymm 2021-03-27 20:36:32 +01:00
parent bb14f7e97a
commit c2434cfedc
Signed by: phlaym
GPG Key ID: A06651BAB6777237

View File

@ -125,8 +125,12 @@ class Poll
public function canVote()
{
$is_authenticated = $this->api->isAuthenticated(false, true);
$is_closed = $this->closed_at <= new \DateTime();
return $is_authenticated && !$is_closed;
return $is_authenticated && !$this->isClosed();
}
public function isClosed()
{
return $this->closed_at <= new \DateTime();
}
public function __toString(): string