Merge pull request #247 from nextcloud/remove/notifications
Remove the notifications
This commit is contained in:
commit
fd9154f3c2
|
@ -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>
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
}
|
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
30
lib/Migration/Version010102Date20200323120846.php
Normal file
30
lib/Migration/Version010102Date20200323120846.php
Normal 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;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue