Skip to content
This repository has been archived by the owner on Oct 16, 2018. It is now read-only.

Commit

Permalink
This app is obsoleted with Notifications app for Nextcloud 14
Browse files Browse the repository at this point in the history
Signed-off-by: Joas Schilling <coding@schilljs.com>
  • Loading branch information
nickvergessen committed Feb 16, 2018
1 parent 3359ee5 commit 0f1e454
Show file tree
Hide file tree
Showing 12 changed files with 40 additions and 879 deletions.
6 changes: 6 additions & 0 deletions README.md
@@ -1,3 +1,9 @@
#⚠️ App "admin_notifications" is obsoleted with Nextcloud 14 ⚠️
The functionality of the "admin_notifications" app has been merged into the default notifications app for Nextcloud 14. You can savely uninstall and delete the "admin_notifications" app, because it does not do anything anymore.

The new documentation is in the [notifications repository](https://github.com/nextcloud/notifications/blob/master/docs/admin-notifications.md).


# 🔧🔔 Admin notifications

Allows admins to generate notifications for users via the console or an HTTP endpoint
Expand Down
12 changes: 5 additions & 7 deletions appinfo/info.xml
Expand Up @@ -2,10 +2,12 @@
<info>
<id>admin_notifications</id>
<name>Admin notifications</name>
<description><![CDATA[Allows admins to generate notifications for users via the console or an HTTP endpoint]]></description>
<description><![CDATA[**Obsoleted with Nextcloud 14:** The functionality of the "admin_notifications" app has been merged into the default notifications app for Nextcloud 14. You can savely uninstall and delete the "admin_notifications" app, because it does not do anything anymore.
Allows admins to generate notifications for users via the console or an HTTP endpoint]]></description>
<licence>AGPL</licence>
<author>Joas Schilling</author>
<version>1.0.1</version>
<version>1.0.2</version>
<namespace>AdminNotifications</namespace>

<category>organization</category>
Expand All @@ -17,14 +19,10 @@
<repository type="git">https://github.com/nextcloud/admin_notifications.git</repository>

<dependencies>
<nextcloud min-version="11" max-version="14" />
<nextcloud min-version="14" max-version="14" />
</dependencies>

<types>
<logging/>
</types>

<commands>
<command>OCA\AdminNotifications\Command\Generate</command>
</commands>
</info>
28 changes: 0 additions & 28 deletions appinfo/routes.php

This file was deleted.

41 changes: 29 additions & 12 deletions lib/AppInfo/Application.php
Expand Up @@ -34,19 +34,36 @@ public function __construct() {
}

public function register() {
$this->registerNotifier();
}
$config = $this->getContainer()->getServer()->getConfig();

if ($config->getAppValue(self::APP_ID, 'published-deprecation-notification', 'no') === 'yes') {
return;
}

$notificationManager = $this->getContainer()->getServer()->getNotificationManager();
$groupManager = $this->getContainer()->getServer()->getGroupManager();

$notification = $notificationManager->createNotification();
$time = time();
$datetime = new \DateTime();
$datetime->setTimestamp($time);

try {
$notification->setApp(Application::APP_ID)
->setDateTime($datetime)
->setObject(Application::APP_ID, dechex($time))
->setSubject('cli', ['App "admin_notifications" is obsolete'])
->setMessage('cli', ['The functionality of the "admin_notifications" app has been merged into the default notifications app for Nextcloud 14. You can safely uninstall and delete the "admin_notifications" app, because it does not do anything anymore.']);

$admins = $groupManager->get('admin');
foreach ($admins->getUsers() as $admin) {
$notification->setUser($admin->getUID());
$notificationManager->notify($notification);
}
} catch (\InvalidArgumentException $e) {
return;
}

protected function registerNotifier() {
$this->getContainer()->getServer()->getNotificationManager()->registerNotifier(function() {
return $this->getContainer()->query(Notifier::class);
}, function() {
$l = $this->getContainer()->getServer()->getL10NFactory()->get(self::APP_ID);
return [
'id' => self::APP_ID,
'name' => $l->t('Admin notifications'),
];
});
$config->setAppValue(self::APP_ID, 'published-deprecation-notification', 'yes');
}
}
109 changes: 0 additions & 109 deletions lib/Controller/APIController.php

This file was deleted.

79 changes: 0 additions & 79 deletions lib/Notification/Notifier.php

This file was deleted.

0 comments on commit 0f1e454

Please sign in to comment.