aboutsummaryrefslogtreecommitdiffstats
path: root/apps/settings/lib/Hooks.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/settings/lib/Hooks.php')
-rw-r--r--apps/settings/lib/Hooks.php81
1 files changed, 18 insertions, 63 deletions
diff --git a/apps/settings/lib/Hooks.php b/apps/settings/lib/Hooks.php
index 30cae96b9f0..f59013ca5e1 100644
--- a/apps/settings/lib/Hooks.php
+++ b/apps/settings/lib/Hooks.php
@@ -1,28 +1,8 @@
<?php
+
/**
- * @copyright Copyright (c) 2017 Joas Schilling <coding@schilljs.com>
- *
- * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- * @author Joas Schilling <coding@schilljs.com>
- * @author Morris Jobke <hey@morrisjobke.de>
- * @author Thomas Citharel <nextcloud@tcit.fr>
- *
- * @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/>.
- *
+ * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\Settings;
@@ -40,43 +20,17 @@ use OCP\Mail\IMailer;
class Hooks {
- /** @var IActivityManager */
- protected $activityManager;
- /** @var IGroupManager|\OC\Group\Manager */
- protected $groupManager;
- /** @var IUserManager */
- protected $userManager;
- /** @var IUserSession */
- protected $userSession;
- /** @var IURLGenerator */
- protected $urlGenerator;
- /** @var IMailer */
- protected $mailer;
- /** @var IConfig */
- protected $config;
- /** @var IFactory */
- protected $languageFactory;
- /** @var Defaults */
- protected $defaults;
-
- public function __construct(IActivityManager $activityManager,
- IGroupManager $groupManager,
- IUserManager $userManager,
- IUserSession $userSession,
- IURLGenerator $urlGenerator,
- IMailer $mailer,
- IConfig $config,
- IFactory $languageFactory,
- Defaults $defaults) {
- $this->activityManager = $activityManager;
- $this->groupManager = $groupManager;
- $this->userManager = $userManager;
- $this->userSession = $userSession;
- $this->urlGenerator = $urlGenerator;
- $this->mailer = $mailer;
- $this->config = $config;
- $this->languageFactory = $languageFactory;
- $this->defaults = $defaults;
+ public function __construct(
+ protected IActivityManager $activityManager,
+ protected IGroupManager $groupManager,
+ protected IUserManager $userManager,
+ protected IUserSession $userSession,
+ protected IURLGenerator $urlGenerator,
+ protected IMailer $mailer,
+ protected IConfig $config,
+ protected IFactory $languageFactory,
+ protected Defaults $defaults,
+ ) {
}
/**
@@ -158,8 +112,8 @@ class Hooks {
* @throws \BadMethodCallException
*/
public function onChangeEmail(IUser $user, $oldMailAddress) {
- if ($oldMailAddress === $user->getEMailAddress() ||
- $user->getLastLogin() === 0) {
+ if ($oldMailAddress === $user->getEMailAddress()
+ || $user->getLastLogin() === 0) {
// Email didn't really change or user didn't login,
// so don't create activities and emails.
return;
@@ -170,6 +124,7 @@ class Hooks {
->setType('personal_settings')
->setAffectedUser($user->getUID());
+ $instanceName = $this->defaults->getName();
$instanceUrl = $this->urlGenerator->getAbsoluteURL('/');
$language = $this->languageFactory->getUserLanguage($user);
$l = $this->languageFactory->get('settings', $language);
@@ -206,7 +161,7 @@ class Hooks {
'instanceUrl' => $instanceUrl,
]);
- $template->setSubject($l->t('Email address for %1$s changed on %2$s', [$user->getDisplayName(), $instanceUrl]));
+ $template->setSubject($l->t('Email address for %1$s changed on %2$s', [$user->getDisplayName(), $instanceName]));
$template->addHeader();
$template->addHeading($l->t('Email address changed for %s', [$user->getDisplayName()]), false);
$template->addBodyText($text . ' ' . $l->t('If you did not request this, please contact an administrator.'));