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

github.com/nextcloud/spreed.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2022-09-20 17:00:38 +0300
committerJoas Schilling <coding@schilljs.com>2022-09-20 17:00:38 +0300
commit5acc1857c28f4e55b29adbb25ba846164c912de3 (patch)
treee088e26e93e35f6bea2e06ba617f9e904549b3e3 /lib
parent4577103a0de862885d15daa16afe177393c670fa (diff)
Restrict polls from one-to-one chatsbugfix/7934/restrict-polls-from-one-to-one-chats
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/Controller/PollController.php5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Controller/PollController.php b/lib/Controller/PollController.php
index 15d395bd7..8deb0ead2 100644
--- a/lib/Controller/PollController.php
+++ b/lib/Controller/PollController.php
@@ -30,6 +30,7 @@ use OCA\Talk\Chat\ChatManager;
use OCA\Talk\Exceptions\WrongPermissionsException;
use OCA\Talk\Model\Poll;
use OCA\Talk\Model\Vote;
+use OCA\Talk\Room;
use OCA\Talk\Service\AttachmentService;
use OCA\Talk\Service\PollService;
use OCP\AppFramework\Db\DoesNotExistException;
@@ -76,6 +77,10 @@ class PollController extends AEnvironmentAwareController {
* @return DataResponse
*/
public function createPoll(string $question, array $options, int $resultMode, int $maxVotes): DataResponse {
+ if ($this->room->getType() === Room::TYPE_ONE_TO_ONE) {
+ return new DataResponse([], Http::STATUS_BAD_REQUEST);
+ }
+
$attendee = $this->participant->getAttendee();
try {
$poll = $this->pollService->createPoll(