Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
e16001b
feat: init files_reminders migration
Pytal Jul 31, 2023
59a2ef4
feat(files_reminders): add Application
Pytal Jul 31, 2023
b75fac3
feat(files_reminders): add info xml
Pytal Jul 31, 2023
a3ac1b8
feat(files_reminders): add background jobs
Pytal Jul 31, 2023
ea5e128
feat(files_reminders): add service and notifier
Pytal Jul 31, 2023
c8a32a7
feat(files_reminders): add list command
Pytal Jul 31, 2023
163b059
enh: use datetime
Pytal Jul 31, 2023
4fabd77
enh: add created at
Pytal Jul 31, 2023
774e3e6
enh: implement JsonSerializable
Pytal Jul 31, 2023
a7892fb
feat(files_reminders): add api controller
Pytal Jul 31, 2023
cfbac9b
fix: add composer autoload
Pytal Jul 31, 2023
beb8a27
enh: add to shipped
Pytal Jul 31, 2023
fa77564
enh: rename to due date
Pytal Jul 31, 2023
7637bf2
fix: catch Throwable
Pytal Jul 31, 2023
5ff178a
enh: add updated at
Pytal Jul 31, 2023
8870585
feat(files_reminders): create or update
Pytal Jul 31, 2023
05e454e
fix: update find due query
Pytal Jul 31, 2023
777a791
feat(files_reminders): add remove endpoint
Pytal Jul 31, 2023
d31302e
fix: create only if file exists
Pytal Jul 31, 2023
bdf0741
enh: return created status code
Pytal Jul 31, 2023
b04d1a7
enh: comment interval
Pytal Jul 31, 2023
db7f5a2
enh: serialize path
Pytal Jul 31, 2023
9bd7ddd
enh: does not exist return null
Pytal Jul 31, 2023
3ade06c
fix: return ocs data
Pytal Jul 31, 2023
7daf11f
fix: remove throwable handling
Pytal Jul 31, 2023
7617519
fix: construct background jobs
Pytal Jul 31, 2023
f865c3a
enh: handle node deleted
Pytal Aug 1, 2023
9e8354e
fix: exit on reminder not found
Pytal Aug 1, 2023
c4b7056
fix: catch NodeNotFoundException in notifier
Pytal Aug 1, 2023
7beef65
enh: highlight filename
Pytal Aug 1, 2023
7381c80
fix: remove unnecessary parsed subject
Pytal Aug 1, 2023
d619166
fix: return null if table exists
Pytal Aug 1, 2023
113d061
enh: add codeowner
Pytal Aug 1, 2023
e320166
enh: add json output to command
Pytal Aug 1, 2023
2c4b562
fix: ignore non-existing
Pytal Aug 1, 2023
af98c70
fix(ci): add to enabled apps
Pytal Aug 1, 2023
5a11535
fix: set endpoint description
Pytal Aug 2, 2023
a806bd0
enh: handle user deleted
Pytal Aug 3, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
enh: handle user deleted
Signed-off-by: Christopher Ng <[email protected]>
  • Loading branch information
Pytal committed Aug 3, 2023
commit a806bd0d3c53d7d12fe2c0e9a6559f1ac71ca86f
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
'OCA\\FilesReminders\\Exception\\NodeNotFoundException' => $baseDir . '/../lib/Exception/NodeNotFoundException.php',
'OCA\\FilesReminders\\Exception\\UserNotFoundException' => $baseDir . '/../lib/Exception/UserNotFoundException.php',
'OCA\\FilesReminders\\Listener\\NodeDeletedListener' => $baseDir . '/../lib/Listener/NodeDeletedListener.php',
'OCA\\FilesReminders\\Listener\\UserDeletedListener' => $baseDir . '/../lib/Listener/UserDeletedListener.php',
'OCA\\FilesReminders\\Migration\\Version10000Date20230725162149' => $baseDir . '/../lib/Migration/Version10000Date20230725162149.php',
'OCA\\FilesReminders\\Model\\RichReminder' => $baseDir . '/../lib/Model/RichReminder.php',
'OCA\\FilesReminders\\Notification\\Notifier' => $baseDir . '/../lib/Notification/Notifier.php',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class ComposerStaticInitFilesReminders
'OCA\\FilesReminders\\Exception\\NodeNotFoundException' => __DIR__ . '/..' . '/../lib/Exception/NodeNotFoundException.php',
'OCA\\FilesReminders\\Exception\\UserNotFoundException' => __DIR__ . '/..' . '/../lib/Exception/UserNotFoundException.php',
'OCA\\FilesReminders\\Listener\\NodeDeletedListener' => __DIR__ . '/..' . '/../lib/Listener/NodeDeletedListener.php',
'OCA\\FilesReminders\\Listener\\UserDeletedListener' => __DIR__ . '/..' . '/../lib/Listener/UserDeletedListener.php',
'OCA\\FilesReminders\\Migration\\Version10000Date20230725162149' => __DIR__ . '/..' . '/../lib/Migration/Version10000Date20230725162149.php',
'OCA\\FilesReminders\\Model\\RichReminder' => __DIR__ . '/..' . '/../lib/Model/RichReminder.php',
'OCA\\FilesReminders\\Notification\\Notifier' => __DIR__ . '/..' . '/../lib/Notification/Notifier.php',
Expand Down
4 changes: 2 additions & 2 deletions apps/files_reminders/composer/composer/installed.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
'name' => '__root__',
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => 'cce2e1543b16a04e6b9fc1ba3f89fbc47f12e773',
'reference' => '5a11535c51ae0277f6bb0af048215e329b6068d0',
'type' => 'library',
'install_path' => __DIR__ . '/../',
'aliases' => array(),
Expand All @@ -13,7 +13,7 @@
'__root__' => array(
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => 'cce2e1543b16a04e6b9fc1ba3f89fbc47f12e773',
'reference' => '5a11535c51ae0277f6bb0af048215e329b6068d0',
'type' => 'library',
'install_path' => __DIR__ . '/../',
'aliases' => array(),
Expand Down
4 changes: 4 additions & 0 deletions apps/files_reminders/lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@
namespace OCA\FilesReminders\AppInfo;

use OCA\FilesReminders\Listener\NodeDeletedListener;
use OCA\FilesReminders\Listener\UserDeletedListener;
use OCA\FilesReminders\Notification\Notifier;
use OCP\AppFramework\App;
use OCP\AppFramework\Bootstrap\IBootContext;
use OCP\AppFramework\Bootstrap\IBootstrap;
use OCP\AppFramework\Bootstrap\IRegistrationContext;
use OCP\Files\Events\Node\NodeDeletedEvent;
use OCP\User\Events\UserDeletedEvent;

class Application extends App implements IBootstrap {
public const APP_ID = 'files_reminders';
Expand All @@ -46,6 +48,8 @@ public function boot(IBootContext $context): void {

public function register(IRegistrationContext $context): void {
$context->registerNotifierService(Notifier::class);

$context->registerEventListener(NodeDeletedEvent::class, NodeDeletedListener::class);
$context->registerEventListener(UserDeletedEvent::class, UserDeletedListener::class);
}
}
47 changes: 47 additions & 0 deletions apps/files_reminders/lib/Listener/UserDeletedListener.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php

declare(strict_types=1);

/**
* @copyright 2023 Christopher Ng <[email protected]>
*
* @author Christopher Ng <[email protected]>
*
* @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\FilesReminders\Listener;

use OCA\FilesReminders\Service\ReminderService;
use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\IEventListener;
use OCP\User\Events\UserDeletedEvent;

class UserDeletedListener implements IEventListener {
public function __construct(
private ReminderService $reminderService,
) {}

public function handle(Event $event): void {
if (!($event instanceof UserDeletedEvent)) {
return;
}

$user = $event->getUser();
$this->reminderService->removeAllForUser($user);
}
}
7 changes: 7 additions & 0 deletions apps/files_reminders/lib/Service/ReminderService.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,13 @@ public function removeAllForNode(Node $node): void {
}
}

public function removeAllForUser(IUser $user): void {
$reminders = $this->reminderMapper->findAllForUser($user);
foreach ($reminders as $reminder) {
$this->reminderMapper->delete($reminder);
}
}

/**
* @throws DoesNotExistException
* @throws UserNotFoundException
Expand Down