From 5c4a7628f40865bcfdf7676dcbe6207073f827f5 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Mon, 23 Mar 2020 13:14:51 +0100 Subject: [PATCH] Remove the notifications Signed-off-by: Roeland Jago Douma --- appinfo/info.xml | 2 +- lib/Controller/ApiController.php | 3 - lib/Controller/PageController.php | 1 - lib/Db/Notification.php | 46 --------- lib/Db/NotificationMapper.php | 94 ------------------- .../Version010102Date20200323120846.php | 30 ++++++ 6 files changed, 31 insertions(+), 145 deletions(-) delete mode 100644 lib/Db/Notification.php delete mode 100644 lib/Db/NotificationMapper.php create mode 100644 lib/Migration/Version010102Date20200323120846.php diff --git a/appinfo/info.xml b/appinfo/info.xml index 30a0a46..2bdd6a8 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -5,7 +5,7 @@ Forms A forms app, similar to Google Forms. A forms app, similar to Google Forms with the possibility to restrict access (members, certain groups/users, and public). - 1.1.1 + 1.1.2 agpl Vinzenz Rosenkranz René Gieling diff --git a/lib/Controller/ApiController.php b/lib/Controller/ApiController.php index 2b8e40a..c53933c 100644 --- a/lib/Controller/ApiController.php +++ b/lib/Controller/ApiController.php @@ -43,8 +43,6 @@ use OCA\Forms\Db\Event; use OCA\Forms\Db\EventMapper; use OCA\Forms\Db\Vote; use OCA\Forms\Db\VoteMapper; -use OCA\Forms\Db\Notification; -use OCA\Forms\Db\NotificationMapper; use OCA\Forms\Db\Question; use OCA\Forms\Db\QuestionMapper; @@ -402,7 +400,6 @@ class ApiController extends Controller { return new DataResponse(null, Http::STATUS_UNAUTHORIZED); } $this->voteMapper->deleteByForm($id); - // $this->notificationMapper->deleteByForm($id); $this->questionMapper->deleteByForm($id); $this->answerMapper->deleteByForm($id); $this->eventMapper->delete($formToDelete); diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php index 0a3e0d2..1e2956b 100644 --- a/lib/Controller/PageController.php +++ b/lib/Controller/PageController.php @@ -225,7 +225,6 @@ class PageController extends Controller { * @param string $userId * @param string $answers * @param string $options question id - * @param bool $receiveNotifications * @param bool $changed * @return RedirectResponse */ diff --git a/lib/Db/Notification.php b/lib/Db/Notification.php deleted file mode 100644 index 51b6be9..0000000 --- a/lib/Db/Notification.php +++ /dev/null @@ -1,46 +0,0 @@ - - * - * @author Vinzenz Rosenkranz - * @author Kai Schröer - * - * @license GNU AGPL version 3 or any later version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - * - */ - -namespace OCA\Forms\Db; - -use OCP\AppFramework\Db\Entity; - -/** - * @method string getUserId() - * @method void setUserId(string $value) - * @method integer getFormId() - * @method void setFormId(integer $value) - */ -class Notification extends Entity { - protected $userId; - protected $formId; - - /** - * Notification constructor. - */ - public function __construct() { - $this->addType('formId', 'integer'); - } -} diff --git a/lib/Db/NotificationMapper.php b/lib/Db/NotificationMapper.php deleted file mode 100644 index f76c6e8..0000000 --- a/lib/Db/NotificationMapper.php +++ /dev/null @@ -1,94 +0,0 @@ - - * - * @author Vinzenz Rosenkranz - * @author René Gieling -* - * @license GNU AGPL version 3 or any later version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - * - */ - -namespace OCA\Forms\Db; - -use OCP\DB\QueryBuilder\IQueryBuilder; -use OCP\IDBConnection; -use OCP\AppFramework\Db\QBMapper; - -class NotificationMapper extends QBMapper { - - public function __construct(IDBConnection $db) { - parent::__construct($db, 'forms_notif', Notification::class); - } - - /** - * @param int $formId - * @throws \OCP\AppFramework\Db\DoesNotExistException if not found - * @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException if more than one result - * @return Notification[] - */ - - public function findAllByForm(int $formId): array { - $qb = $this->db->getQueryBuilder(); - - $qb->select('*') - ->from($this->getTableName()) - ->where( - $qb->expr()->eq('form_id', $qb->createNamedParameter($formId, IQueryBuilder::PARAM_INT)) - ); - - return $this->findEntities($qb); - } - - - /** - * @param int $formId - * @param string $userId - * @throws \OCP\AppFramework\Db\DoesNotExistException if not found - * @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException if more than one result - * @return Notification[] - */ - public function findByUserAndForm(int $formId, string $userId): array { - $qb = $this->db->getQueryBuilder(); - - $qb->select('*') - ->from($this->getTableName()) - ->where( - $qb->expr()->eq('form_id', $qb->createNamedParameter($formId, IQueryBuilder::PARAM_INT)) - ) - ->andWhere( - $qb->expr()->eq('user_id', $qb->createNamedParameter($userId, IQueryBuilder::PARAM_STR)) - ); - - return $this->findEntities($qb); - } - - /** - * @param int $formId - */ - public function deleteByForm(int $formId): void { - $qb = $this->db->getQueryBuilder(); - - $qb->delete($this->getTableName()) - ->where( - $qb->expr()->eq('form_id', $qb->createNamedParameter($formId, IQueryBuilder::PARAM_INT)) - ); - - $qb->execute(); - } - -} diff --git a/lib/Migration/Version010102Date20200323120846.php b/lib/Migration/Version010102Date20200323120846.php new file mode 100644 index 0000000..82c397e --- /dev/null +++ b/lib/Migration/Version010102Date20200323120846.php @@ -0,0 +1,30 @@ +dropTable('forms_notif'); + + return $schema; + } +}