Skip to content

Commit 855be71

Browse files
authored
Merge pull request #34706 from nextcloud/enh/noid/improve-one-click-instance-notification
update notifications for one-click instances
2 parents 6435191 + 9e7e1e8 commit 855be71

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

core/Notification/CoreNotifier.php

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,23 @@
2828
*/
2929
namespace OC\Core\Notification;
3030

31+
use OCP\IConfig;
3132
use OCP\IURLGenerator;
3233
use OCP\L10N\IFactory;
34+
use OCP\Notification\IAction;
3335
use OCP\Notification\INotification;
3436
use OCP\Notification\INotifier;
3537

3638
class CoreNotifier implements INotifier {
39+
/** @var IConfig */
40+
private $config;
3741
/** @var IFactory */
3842
private $l10nFactory;
3943
/** @var IURLGenerator */
4044
private $url;
4145

42-
public function __construct(IFactory $factory, IURLGenerator $url) {
46+
public function __construct(IConfig $config, IFactory $factory, IURLGenerator $url) {
47+
$this->config = $config;
4348
$this->l10nFactory = $factory;
4449
$this->url = $url;
4550
}
@@ -79,9 +84,16 @@ public function prepare(INotification $notification, string $languageCode): INot
7984

8085
if ($notification->getSubject() === 'user_limit_reached') {
8186
$notification->setParsedSubject($l->t('The user limit of this instance is reached.'));
82-
$notification->setParsedMessage($l->t('Enter your subscription key to increase the user limit. For more information about Nextcloud Enterprise see our website.'));
83-
$notification->setLink('https://nextcloud.com/enterprise/');
87+
$notification->setParsedMessage($l->t('Enter your subscription key in the support app in order to increase the user limit. This does also grant you all additional benefits that Nextcloud Enterprise offers and is highly recommended for the operation in companies.'));
8488
$notification->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'places/contacts.svg')));
89+
$action = $notification->createAction();
90+
$label = $l->t('Learn more ↗');
91+
$link = $this->config->getSystemValueString('one-click-instance.link', 'https://nextcloud.com/enterprise/');
92+
$action->setLabel($label)
93+
->setParsedLabel($label)
94+
->setLink($link, IAction::TYPE_WEB)
95+
->setPrimary(true);
96+
$notification->addParsedAction($action);
8597
return $notification;
8698
}
8799

0 commit comments

Comments
 (0)