Merge pull request #247 from nextcloud/remove/notifications

Remove the notifications
This commit is contained in:
John Molakvoæ 2020-03-23 13:36:09 +01:00 committed by GitHub
commit fd9154f3c2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 31 additions and 145 deletions

View file

@ -5,7 +5,7 @@
<name>Forms</name>
<summary>A forms app, similar to Google Forms.</summary>
<description>A forms app, similar to Google Forms with the possibility to restrict access (members, certain groups/users, and public).</description>
<version>1.1.1</version>
<version>1.1.2</version>
<licence>agpl</licence>
<author>Vinzenz Rosenkranz</author>
<author>René Gieling</author>

View file

@ -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);

View file

@ -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
*/

View file

@ -1,46 +0,0 @@
<?php
declare(strict_types=1);
/**
* @copyright Copyright (c) 2017 Vinzenz Rosenkranz <vinzenz.rosenkranz@gmail.com>
*
* @author Vinzenz Rosenkranz <vinzenz.rosenkranz@gmail.com>
* @author Kai Schröer <git@schroeer.co>
*
* @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 <http://www.gnu.org/licenses/>.
*
*/
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');
}
}

View file

@ -1,94 +0,0 @@
<?php
declare(strict_types=1);
/**
* @copyright Copyright (c) 2017 Vinzenz Rosenkranz <vinzenz.rosenkranz@gmail.com>
*
* @author Vinzenz Rosenkranz <vinzenz.rosenkranz@gmail.com>
* @author René Gieling <github@dartcafe.de>
*
* @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 <http://www.gnu.org/licenses/>.
*
*/
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();
}
}

View file

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace OCA\Forms\Migration;
use Closure;
use OCP\DB\ISchemaWrapper;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;
/**
* Auto-generated migration step: Please modify to your needs!
*/
class Version010102Date20200323120846 extends SimpleMigrationStep {
/**
* @param IOutput $output
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
* @param array $options
* @return null|ISchemaWrapper
*/
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) {
/** @var ISchemaWrapper $schema */
$schema = $schemaClosure();
$schema->dropTable('forms_notif');
return $schema;
}
}