Completed
Push — master ( 7d8a07...07278d )
by Daniel
23:48 queued 29s
created
apps/files_reminders/composer/composer/autoload_static.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -6,47 +6,47 @@
 block discarded – undo
6 6
 
7 7
 class ComposerStaticInitFilesReminders
8 8
 {
9
-    public static $prefixLengthsPsr4 = array (
9
+    public static $prefixLengthsPsr4 = array(
10 10
         'O' => 
11
-        array (
11
+        array(
12 12
             'OCA\\FilesReminders\\' => 19,
13 13
         ),
14 14
     );
15 15
 
16
-    public static $prefixDirsPsr4 = array (
16
+    public static $prefixDirsPsr4 = array(
17 17
         'OCA\\FilesReminders\\' => 
18
-        array (
19
-            0 => __DIR__ . '/..' . '/../lib',
18
+        array(
19
+            0 => __DIR__.'/..'.'/../lib',
20 20
         ),
21 21
     );
22 22
 
23
-    public static $classMap = array (
24
-        'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
25
-        'OCA\\FilesReminders\\AppInfo\\Application' => __DIR__ . '/..' . '/../lib/AppInfo/Application.php',
26
-        'OCA\\FilesReminders\\BackgroundJob\\CleanUpReminders' => __DIR__ . '/..' . '/../lib/BackgroundJob/CleanUpReminders.php',
27
-        'OCA\\FilesReminders\\BackgroundJob\\ScheduledNotifications' => __DIR__ . '/..' . '/../lib/BackgroundJob/ScheduledNotifications.php',
28
-        'OCA\\FilesReminders\\Command\\ListCommand' => __DIR__ . '/..' . '/../lib/Command/ListCommand.php',
29
-        'OCA\\FilesReminders\\Controller\\ApiController' => __DIR__ . '/..' . '/../lib/Controller/ApiController.php',
30
-        'OCA\\FilesReminders\\Dav\\PropFindPlugin' => __DIR__ . '/..' . '/../lib/Dav/PropFindPlugin.php',
31
-        'OCA\\FilesReminders\\Db\\Reminder' => __DIR__ . '/..' . '/../lib/Db/Reminder.php',
32
-        'OCA\\FilesReminders\\Db\\ReminderMapper' => __DIR__ . '/..' . '/../lib/Db/ReminderMapper.php',
33
-        'OCA\\FilesReminders\\Exception\\NodeNotFoundException' => __DIR__ . '/..' . '/../lib/Exception/NodeNotFoundException.php',
34
-        'OCA\\FilesReminders\\Exception\\ReminderNotFoundException' => __DIR__ . '/..' . '/../lib/Exception/ReminderNotFoundException.php',
35
-        'OCA\\FilesReminders\\Exception\\UserNotFoundException' => __DIR__ . '/..' . '/../lib/Exception/UserNotFoundException.php',
36
-        'OCA\\FilesReminders\\Listener\\LoadAdditionalScriptsListener' => __DIR__ . '/..' . '/../lib/Listener/LoadAdditionalScriptsListener.php',
37
-        'OCA\\FilesReminders\\Listener\\NodeDeletedListener' => __DIR__ . '/..' . '/../lib/Listener/NodeDeletedListener.php',
38
-        'OCA\\FilesReminders\\Listener\\SabrePluginAddListener' => __DIR__ . '/..' . '/../lib/Listener/SabrePluginAddListener.php',
39
-        'OCA\\FilesReminders\\Listener\\UserDeletedListener' => __DIR__ . '/..' . '/../lib/Listener/UserDeletedListener.php',
40
-        'OCA\\FilesReminders\\Migration\\Version10000Date20230725162149' => __DIR__ . '/..' . '/../lib/Migration/Version10000Date20230725162149.php',
41
-        'OCA\\FilesReminders\\Model\\RichReminder' => __DIR__ . '/..' . '/../lib/Model/RichReminder.php',
42
-        'OCA\\FilesReminders\\Notification\\Notifier' => __DIR__ . '/..' . '/../lib/Notification/Notifier.php',
43
-        'OCA\\FilesReminders\\Service\\ReminderService' => __DIR__ . '/..' . '/../lib/Service/ReminderService.php',
44
-        'OCA\\FilesReminders\\SetupChecks\\NeedNotificationsApp' => __DIR__ . '/..' . '/../lib/SetupChecks/NeedNotificationsApp.php',
23
+    public static $classMap = array(
24
+        'Composer\\InstalledVersions' => __DIR__.'/..'.'/composer/InstalledVersions.php',
25
+        'OCA\\FilesReminders\\AppInfo\\Application' => __DIR__.'/..'.'/../lib/AppInfo/Application.php',
26
+        'OCA\\FilesReminders\\BackgroundJob\\CleanUpReminders' => __DIR__.'/..'.'/../lib/BackgroundJob/CleanUpReminders.php',
27
+        'OCA\\FilesReminders\\BackgroundJob\\ScheduledNotifications' => __DIR__.'/..'.'/../lib/BackgroundJob/ScheduledNotifications.php',
28
+        'OCA\\FilesReminders\\Command\\ListCommand' => __DIR__.'/..'.'/../lib/Command/ListCommand.php',
29
+        'OCA\\FilesReminders\\Controller\\ApiController' => __DIR__.'/..'.'/../lib/Controller/ApiController.php',
30
+        'OCA\\FilesReminders\\Dav\\PropFindPlugin' => __DIR__.'/..'.'/../lib/Dav/PropFindPlugin.php',
31
+        'OCA\\FilesReminders\\Db\\Reminder' => __DIR__.'/..'.'/../lib/Db/Reminder.php',
32
+        'OCA\\FilesReminders\\Db\\ReminderMapper' => __DIR__.'/..'.'/../lib/Db/ReminderMapper.php',
33
+        'OCA\\FilesReminders\\Exception\\NodeNotFoundException' => __DIR__.'/..'.'/../lib/Exception/NodeNotFoundException.php',
34
+        'OCA\\FilesReminders\\Exception\\ReminderNotFoundException' => __DIR__.'/..'.'/../lib/Exception/ReminderNotFoundException.php',
35
+        'OCA\\FilesReminders\\Exception\\UserNotFoundException' => __DIR__.'/..'.'/../lib/Exception/UserNotFoundException.php',
36
+        'OCA\\FilesReminders\\Listener\\LoadAdditionalScriptsListener' => __DIR__.'/..'.'/../lib/Listener/LoadAdditionalScriptsListener.php',
37
+        'OCA\\FilesReminders\\Listener\\NodeDeletedListener' => __DIR__.'/..'.'/../lib/Listener/NodeDeletedListener.php',
38
+        'OCA\\FilesReminders\\Listener\\SabrePluginAddListener' => __DIR__.'/..'.'/../lib/Listener/SabrePluginAddListener.php',
39
+        'OCA\\FilesReminders\\Listener\\UserDeletedListener' => __DIR__.'/..'.'/../lib/Listener/UserDeletedListener.php',
40
+        'OCA\\FilesReminders\\Migration\\Version10000Date20230725162149' => __DIR__.'/..'.'/../lib/Migration/Version10000Date20230725162149.php',
41
+        'OCA\\FilesReminders\\Model\\RichReminder' => __DIR__.'/..'.'/../lib/Model/RichReminder.php',
42
+        'OCA\\FilesReminders\\Notification\\Notifier' => __DIR__.'/..'.'/../lib/Notification/Notifier.php',
43
+        'OCA\\FilesReminders\\Service\\ReminderService' => __DIR__.'/..'.'/../lib/Service/ReminderService.php',
44
+        'OCA\\FilesReminders\\SetupChecks\\NeedNotificationsApp' => __DIR__.'/..'.'/../lib/SetupChecks/NeedNotificationsApp.php',
45 45
     );
46 46
 
47 47
     public static function getInitializer(ClassLoader $loader)
48 48
     {
49
-        return \Closure::bind(function () use ($loader) {
49
+        return \Closure::bind(function() use ($loader) {
50 50
             $loader->prefixLengthsPsr4 = ComposerStaticInitFilesReminders::$prefixLengthsPsr4;
51 51
             $loader->prefixDirsPsr4 = ComposerStaticInitFilesReminders::$prefixDirsPsr4;
52 52
             $loader->classMap = ComposerStaticInitFilesReminders::$classMap;
Please login to merge, or discard this patch.
apps/files_reminders/composer/composer/autoload_classmap.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -6,25 +6,25 @@
 block discarded – undo
6 6
 $baseDir = $vendorDir;
7 7
 
8 8
 return array(
9
-    'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
10
-    'OCA\\FilesReminders\\AppInfo\\Application' => $baseDir . '/../lib/AppInfo/Application.php',
11
-    'OCA\\FilesReminders\\BackgroundJob\\CleanUpReminders' => $baseDir . '/../lib/BackgroundJob/CleanUpReminders.php',
12
-    'OCA\\FilesReminders\\BackgroundJob\\ScheduledNotifications' => $baseDir . '/../lib/BackgroundJob/ScheduledNotifications.php',
13
-    'OCA\\FilesReminders\\Command\\ListCommand' => $baseDir . '/../lib/Command/ListCommand.php',
14
-    'OCA\\FilesReminders\\Controller\\ApiController' => $baseDir . '/../lib/Controller/ApiController.php',
15
-    'OCA\\FilesReminders\\Dav\\PropFindPlugin' => $baseDir . '/../lib/Dav/PropFindPlugin.php',
16
-    'OCA\\FilesReminders\\Db\\Reminder' => $baseDir . '/../lib/Db/Reminder.php',
17
-    'OCA\\FilesReminders\\Db\\ReminderMapper' => $baseDir . '/../lib/Db/ReminderMapper.php',
18
-    'OCA\\FilesReminders\\Exception\\NodeNotFoundException' => $baseDir . '/../lib/Exception/NodeNotFoundException.php',
19
-    'OCA\\FilesReminders\\Exception\\ReminderNotFoundException' => $baseDir . '/../lib/Exception/ReminderNotFoundException.php',
20
-    'OCA\\FilesReminders\\Exception\\UserNotFoundException' => $baseDir . '/../lib/Exception/UserNotFoundException.php',
21
-    'OCA\\FilesReminders\\Listener\\LoadAdditionalScriptsListener' => $baseDir . '/../lib/Listener/LoadAdditionalScriptsListener.php',
22
-    'OCA\\FilesReminders\\Listener\\NodeDeletedListener' => $baseDir . '/../lib/Listener/NodeDeletedListener.php',
23
-    'OCA\\FilesReminders\\Listener\\SabrePluginAddListener' => $baseDir . '/../lib/Listener/SabrePluginAddListener.php',
24
-    'OCA\\FilesReminders\\Listener\\UserDeletedListener' => $baseDir . '/../lib/Listener/UserDeletedListener.php',
25
-    'OCA\\FilesReminders\\Migration\\Version10000Date20230725162149' => $baseDir . '/../lib/Migration/Version10000Date20230725162149.php',
26
-    'OCA\\FilesReminders\\Model\\RichReminder' => $baseDir . '/../lib/Model/RichReminder.php',
27
-    'OCA\\FilesReminders\\Notification\\Notifier' => $baseDir . '/../lib/Notification/Notifier.php',
28
-    'OCA\\FilesReminders\\Service\\ReminderService' => $baseDir . '/../lib/Service/ReminderService.php',
29
-    'OCA\\FilesReminders\\SetupChecks\\NeedNotificationsApp' => $baseDir . '/../lib/SetupChecks/NeedNotificationsApp.php',
9
+    'Composer\\InstalledVersions' => $vendorDir.'/composer/InstalledVersions.php',
10
+    'OCA\\FilesReminders\\AppInfo\\Application' => $baseDir.'/../lib/AppInfo/Application.php',
11
+    'OCA\\FilesReminders\\BackgroundJob\\CleanUpReminders' => $baseDir.'/../lib/BackgroundJob/CleanUpReminders.php',
12
+    'OCA\\FilesReminders\\BackgroundJob\\ScheduledNotifications' => $baseDir.'/../lib/BackgroundJob/ScheduledNotifications.php',
13
+    'OCA\\FilesReminders\\Command\\ListCommand' => $baseDir.'/../lib/Command/ListCommand.php',
14
+    'OCA\\FilesReminders\\Controller\\ApiController' => $baseDir.'/../lib/Controller/ApiController.php',
15
+    'OCA\\FilesReminders\\Dav\\PropFindPlugin' => $baseDir.'/../lib/Dav/PropFindPlugin.php',
16
+    'OCA\\FilesReminders\\Db\\Reminder' => $baseDir.'/../lib/Db/Reminder.php',
17
+    'OCA\\FilesReminders\\Db\\ReminderMapper' => $baseDir.'/../lib/Db/ReminderMapper.php',
18
+    'OCA\\FilesReminders\\Exception\\NodeNotFoundException' => $baseDir.'/../lib/Exception/NodeNotFoundException.php',
19
+    'OCA\\FilesReminders\\Exception\\ReminderNotFoundException' => $baseDir.'/../lib/Exception/ReminderNotFoundException.php',
20
+    'OCA\\FilesReminders\\Exception\\UserNotFoundException' => $baseDir.'/../lib/Exception/UserNotFoundException.php',
21
+    'OCA\\FilesReminders\\Listener\\LoadAdditionalScriptsListener' => $baseDir.'/../lib/Listener/LoadAdditionalScriptsListener.php',
22
+    'OCA\\FilesReminders\\Listener\\NodeDeletedListener' => $baseDir.'/../lib/Listener/NodeDeletedListener.php',
23
+    'OCA\\FilesReminders\\Listener\\SabrePluginAddListener' => $baseDir.'/../lib/Listener/SabrePluginAddListener.php',
24
+    'OCA\\FilesReminders\\Listener\\UserDeletedListener' => $baseDir.'/../lib/Listener/UserDeletedListener.php',
25
+    'OCA\\FilesReminders\\Migration\\Version10000Date20230725162149' => $baseDir.'/../lib/Migration/Version10000Date20230725162149.php',
26
+    'OCA\\FilesReminders\\Model\\RichReminder' => $baseDir.'/../lib/Model/RichReminder.php',
27
+    'OCA\\FilesReminders\\Notification\\Notifier' => $baseDir.'/../lib/Notification/Notifier.php',
28
+    'OCA\\FilesReminders\\Service\\ReminderService' => $baseDir.'/../lib/Service/ReminderService.php',
29
+    'OCA\\FilesReminders\\SetupChecks\\NeedNotificationsApp' => $baseDir.'/../lib/SetupChecks/NeedNotificationsApp.php',
30 30
 );
Please login to merge, or discard this patch.
apps/files_reminders/lib/Notification/Notifier.php 2 patches
Indentation   +86 added lines, -86 removed lines patch added patch discarded remove patch
@@ -21,90 +21,90 @@
 block discarded – undo
21 21
 use OCP\Notification\UnknownNotificationException;
22 22
 
23 23
 class Notifier implements INotifier {
24
-	public function __construct(
25
-		protected IFactory $l10nFactory,
26
-		protected IURLGenerator $urlGenerator,
27
-		protected IRootFolder $root,
28
-	) {
29
-	}
30
-
31
-	public function getID(): string {
32
-		return Application::APP_ID;
33
-	}
34
-
35
-	public function getName(): string {
36
-		return $this->l10nFactory->get(Application::APP_ID)->t('File reminders');
37
-	}
38
-
39
-	/**
40
-	 * @throws UnknownNotificationException
41
-	 */
42
-	public function prepare(INotification $notification, string $languageCode): INotification {
43
-		$l = $this->l10nFactory->get(Application::APP_ID, $languageCode);
44
-
45
-		if ($notification->getApp() !== Application::APP_ID) {
46
-			throw new UnknownNotificationException();
47
-		}
48
-
49
-		switch ($notification->getSubject()) {
50
-			case 'reminder-due':
51
-				$params = $notification->getSubjectParameters();
52
-				$fileId = $params['fileId'];
53
-
54
-				$node = $this->root->getUserFolder($notification->getUser())->getFirstNodeById($fileId);
55
-				if ($node === null) {
56
-					throw new AlreadyProcessedException();
57
-				}
58
-
59
-				$path = rtrim($node->getPath(), '/');
60
-				if (strpos($path, '/' . $notification->getUser() . '/files/') === 0) {
61
-					// Remove /user/files/...
62
-					$fullPath = $path;
63
-					[,,, $path] = explode('/', $fullPath, 4);
64
-				}
65
-
66
-				$link = $this->urlGenerator->linkToRouteAbsolute(
67
-					'files.viewcontroller.showFile',
68
-					['fileid' => $node->getId()],
69
-				);
70
-
71
-				// TRANSLATORS The name placeholder is for a file or folder name
72
-				$subject = $l->t('Reminder for {name}');
73
-				$notification
74
-					->setRichSubject(
75
-						$subject,
76
-						[
77
-							'name' => [
78
-								'type' => 'highlight',
79
-								'id' => (string)$node->getId(),
80
-								'name' => $node->getName(),
81
-							],
82
-						],
83
-					)
84
-					->setLink($link);
85
-
86
-				$label = match ($node->getType()) {
87
-					FileInfo::TYPE_FILE => $l->t('View file'),
88
-					FileInfo::TYPE_FOLDER => $l->t('View folder'),
89
-				};
90
-
91
-				$this->addActionButton($notification, $label);
92
-				break;
93
-			default:
94
-				throw new UnknownNotificationException();
95
-		}
96
-
97
-		return $notification;
98
-	}
99
-
100
-	protected function addActionButton(INotification $notification, string $label): void {
101
-		$action = $notification->createAction();
102
-
103
-		$action->setLabel($label)
104
-			->setParsedLabel($label)
105
-			->setLink($notification->getLink(), IAction::TYPE_WEB)
106
-			->setPrimary(true);
107
-
108
-		$notification->addParsedAction($action);
109
-	}
24
+    public function __construct(
25
+        protected IFactory $l10nFactory,
26
+        protected IURLGenerator $urlGenerator,
27
+        protected IRootFolder $root,
28
+    ) {
29
+    }
30
+
31
+    public function getID(): string {
32
+        return Application::APP_ID;
33
+    }
34
+
35
+    public function getName(): string {
36
+        return $this->l10nFactory->get(Application::APP_ID)->t('File reminders');
37
+    }
38
+
39
+    /**
40
+     * @throws UnknownNotificationException
41
+     */
42
+    public function prepare(INotification $notification, string $languageCode): INotification {
43
+        $l = $this->l10nFactory->get(Application::APP_ID, $languageCode);
44
+
45
+        if ($notification->getApp() !== Application::APP_ID) {
46
+            throw new UnknownNotificationException();
47
+        }
48
+
49
+        switch ($notification->getSubject()) {
50
+            case 'reminder-due':
51
+                $params = $notification->getSubjectParameters();
52
+                $fileId = $params['fileId'];
53
+
54
+                $node = $this->root->getUserFolder($notification->getUser())->getFirstNodeById($fileId);
55
+                if ($node === null) {
56
+                    throw new AlreadyProcessedException();
57
+                }
58
+
59
+                $path = rtrim($node->getPath(), '/');
60
+                if (strpos($path, '/' . $notification->getUser() . '/files/') === 0) {
61
+                    // Remove /user/files/...
62
+                    $fullPath = $path;
63
+                    [,,, $path] = explode('/', $fullPath, 4);
64
+                }
65
+
66
+                $link = $this->urlGenerator->linkToRouteAbsolute(
67
+                    'files.viewcontroller.showFile',
68
+                    ['fileid' => $node->getId()],
69
+                );
70
+
71
+                // TRANSLATORS The name placeholder is for a file or folder name
72
+                $subject = $l->t('Reminder for {name}');
73
+                $notification
74
+                    ->setRichSubject(
75
+                        $subject,
76
+                        [
77
+                            'name' => [
78
+                                'type' => 'highlight',
79
+                                'id' => (string)$node->getId(),
80
+                                'name' => $node->getName(),
81
+                            ],
82
+                        ],
83
+                    )
84
+                    ->setLink($link);
85
+
86
+                $label = match ($node->getType()) {
87
+                    FileInfo::TYPE_FILE => $l->t('View file'),
88
+                    FileInfo::TYPE_FOLDER => $l->t('View folder'),
89
+                };
90
+
91
+                $this->addActionButton($notification, $label);
92
+                break;
93
+            default:
94
+                throw new UnknownNotificationException();
95
+        }
96
+
97
+        return $notification;
98
+    }
99
+
100
+    protected function addActionButton(INotification $notification, string $label): void {
101
+        $action = $notification->createAction();
102
+
103
+        $action->setLabel($label)
104
+            ->setParsedLabel($label)
105
+            ->setLink($notification->getLink(), IAction::TYPE_WEB)
106
+            ->setPrimary(true);
107
+
108
+        $notification->addParsedAction($action);
109
+    }
110 110
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 				}
58 58
 
59 59
 				$path = rtrim($node->getPath(), '/');
60
-				if (strpos($path, '/' . $notification->getUser() . '/files/') === 0) {
60
+				if (strpos($path, '/'.$notification->getUser().'/files/') === 0) {
61 61
 					// Remove /user/files/...
62 62
 					$fullPath = $path;
63 63
 					[,,, $path] = explode('/', $fullPath, 4);
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 						[
77 77
 							'name' => [
78 78
 								'type' => 'highlight',
79
-								'id' => (string)$node->getId(),
79
+								'id' => (string) $node->getId(),
80 80
 								'name' => $node->getName(),
81 81
 							],
82 82
 						],
Please login to merge, or discard this patch.
apps/files_reminders/lib/SetupChecks/NeedNotificationsApp.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -15,25 +15,25 @@
 block discarded – undo
15 15
 use OCP\SetupCheck\SetupResult;
16 16
 
17 17
 class NeedNotificationsApp implements ISetupCheck {
18
-	public function __construct(
19
-		private IAppManager $appManager,
20
-		private IL10N $l10n,
21
-	) {
22
-	}
23
-
24
-	public function getName(): string {
25
-		return $this->l10n->t('Files reminder');
26
-	}
27
-
28
-	public function getCategory(): string {
29
-		return 'system';
30
-	}
31
-
32
-	public function run(): SetupResult {
33
-		if ($this->appManager->isEnabledForAnyone('notifications')) {
34
-			return SetupResult::success($this->l10n->t('This files_reminder can work properly.'));
35
-		} else {
36
-			return SetupResult::warning($this->l10n->t('The files_reminder app needs the notification app to work properly. You should either enable notifications or disable files_reminder.'));
37
-		}
38
-	}
18
+    public function __construct(
19
+        private IAppManager $appManager,
20
+        private IL10N $l10n,
21
+    ) {
22
+    }
23
+
24
+    public function getName(): string {
25
+        return $this->l10n->t('Files reminder');
26
+    }
27
+
28
+    public function getCategory(): string {
29
+        return 'system';
30
+    }
31
+
32
+    public function run(): SetupResult {
33
+        if ($this->appManager->isEnabledForAnyone('notifications')) {
34
+            return SetupResult::success($this->l10n->t('This files_reminder can work properly.'));
35
+        } else {
36
+            return SetupResult::warning($this->l10n->t('The files_reminder app needs the notification app to work properly. You should either enable notifications or disable files_reminder.'));
37
+        }
38
+    }
39 39
 }
Please login to merge, or discard this patch.