]> source.dussan.org Git - nextcloud-server.git/commitdiff
Add an icon to the federated sharing notification 2383/head
authorJoas Schilling <coding@schilljs.com>
Mon, 28 Nov 2016 16:23:42 +0000 (17:23 +0100)
committerJoas Schilling <coding@schilljs.com>
Mon, 28 Nov 2016 16:23:42 +0000 (17:23 +0100)
Signed-off-by: Joas Schilling <coding@schilljs.com>
apps/federatedfilesharing/appinfo/app.php
apps/federatedfilesharing/lib/Notifier.php

index 7f4e46019777a3a47e3dc588655e37dd767e88e8..4a5492b0f1552c4d1a46484842fc3331062b64dc 100644 (file)
@@ -31,10 +31,7 @@ $app->registerSettings();
 
 $manager = \OC::$server->getNotificationManager();
 $manager->registerNotifier(function() {
-       return new Notifier(
-               \OC::$server->getL10NFactory(),
-               \OC::$server->getContactsManager()
-       );
+       return \OC::$server->query(Notifier::class);
 }, function() use ($l) {
        return [
                'id' => 'files_sharing',
index 2cbbea2da427dcc8506dc31c97d21374bea18daa..507dd98330e8466e82bc798f67894af332d4b852 100644 (file)
@@ -27,6 +27,7 @@ namespace OCA\FederatedFileSharing;
 use OC\HintException;
 use OC\Share\Helper;
 use OCP\Contacts\IManager;
+use OCP\IURLGenerator;
 use OCP\L10N\IFactory;
 use OCP\Notification\INotification;
 use OCP\Notification\INotifier;
@@ -36,16 +37,20 @@ class Notifier implements INotifier {
        protected $factory;
        /** @var IManager */
        protected $contactsManager;
+       /** @var IURLGenerator */
+       protected $url;
        /** @var array */
        protected $federatedContacts;
 
        /**
         * @param IFactory $factory
         * @param IManager $contactsManager
+        * @param IURLGenerator $url
         */
-       public function __construct(IFactory $factory, IManager $contactsManager) {
+       public function __construct(IFactory $factory, IManager $contactsManager, IURLGenerator $url) {
                $this->factory = $factory;
                $this->contactsManager = $contactsManager;
+               $this->url = $url;
        }
 
        /**
@@ -65,6 +70,8 @@ class Notifier implements INotifier {
                switch ($notification->getSubject()) {
                        // Deal with known subjects
                        case 'remote_share':
+                               $notification->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg')));
+
                                $params = $notification->getSubjectParameters();
                                if ($params[0] !== $params[1] && $params[1] !== null) {
                                        $notification->setParsedSubject(