Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/polls.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRené Gieling <github@dartcafe.de>2020-08-23 08:59:02 +0300
committerGitHub <noreply@github.com>2020-08-23 08:59:02 +0300
commitbdece5963ba5a88a841ed0dd04050bb1958c2a0f (patch)
treec16490cd29c049b0a0efe9366dddc37af6681f50 /lib/Service
parentf29310618551b688c2bab412cb127b37c64ea3f2 (diff)
parent6b73deac12a2dabc4d94b92ce91eebd04620e3bb (diff)
Merge branch 'dev-1.5' into checkCalendar
Diffstat (limited to 'lib/Service')
-rw-r--r--lib/Service/OptionService.php9
-rw-r--r--lib/Service/ShareService.php1
-rw-r--r--lib/Service/SubscriptionService.php2
3 files changed, 8 insertions, 4 deletions
diff --git a/lib/Service/OptionService.php b/lib/Service/OptionService.php
index 0e2dbb88..3b9f1f87 100644
--- a/lib/Service/OptionService.php
+++ b/lib/Service/OptionService.php
@@ -27,6 +27,8 @@ use Exception;
use OCP\AppFramework\Db\DoesNotExistException;
use OCA\Polls\Exceptions\NotAuthorizedException;
use OCA\Polls\Exceptions\BadRequestException;
+use OCA\Polls\Exceptions\DuplicateEntryException;
+use Doctrine\DBAL\Exception\UniqueConstraintViolationException;
use OCA\Polls\Db\OptionMapper;
use OCA\Polls\Db\Option;
@@ -140,7 +142,12 @@ class OptionService {
$this->option->setPollId($pollId);
$this->setOption($timestamp, $pollOptionText, 0);
- return $this->optionMapper->insert($this->option);
+ try {
+ return $this->optionMapper->insert($this->option);
+ } catch (UniqueConstraintViolationException $e) {
+ throw new DuplicateEntryException('This option already exists');
+ }
+
}
/**
diff --git a/lib/Service/ShareService.php b/lib/Service/ShareService.php
index 095b0fc5..83b20dda 100644
--- a/lib/Service/ShareService.php
+++ b/lib/Service/ShareService.php
@@ -117,7 +117,6 @@ class ShareService {
* @throws NotAuthorizedException
*/
public function add($pollId, $type, $userId, $userEmail = '') {
-
if (!$this->acl->set($pollId)->getAllowEdit()) {
throw new NotAuthorizedException;
}
diff --git a/lib/Service/SubscriptionService.php b/lib/Service/SubscriptionService.php
index 8678817e..9c3f1855 100644
--- a/lib/Service/SubscriptionService.php
+++ b/lib/Service/SubscriptionService.php
@@ -82,8 +82,6 @@ class SubscriptionService {
*/
public function set($pollId, $token, $subscribed) {
if (!$this->acl->set($pollId, $token)->getAllowView()) {
- \OC::$server->getLogger()->alert('Share token: ' . $token);
- \OC::$server->getLogger()->alert('Share PollId: ' . $pollId);
throw new NotAuthorizedException;
}
try {