summaryrefslogtreecommitdiffstats
path: root/settings/Hooks.php
diff options
context:
space:
mode:
Diffstat (limited to 'settings/Hooks.php')
-rw-r--r--settings/Hooks.php33
1 files changed, 32 insertions, 1 deletions
diff --git a/settings/Hooks.php b/settings/Hooks.php
index 9addaea5a91..daf3a40cf1b 100644
--- a/settings/Hooks.php
+++ b/settings/Hooks.php
@@ -23,11 +23,13 @@ namespace OC\Settings;
use OC\Settings\Activity\Provider;
use OCP\Activity\IManager as IActivityManager;
+use OCP\IConfig;
use OCP\IL10N;
use OCP\IURLGenerator;
use OCP\IUser;
use OCP\IUserManager;
use OCP\IUserSession;
+use OCP\L10N\IFactory;
use OCP\Mail\IMailer;
class Hooks {
@@ -42,15 +44,28 @@ class Hooks {
protected $urlGenerator;
/** @var IMailer */
protected $mailer;
+ /** @var IConfig */
+ protected $config;
+ /** @var IFactory */
+ protected $languageFactory;
/** @var IL10N */
protected $l;
- public function __construct(IActivityManager $activityManager, IUserManager $userManager, IUserSession $userSession, IURLGenerator $urlGenerator, IMailer $mailer, IL10N $l) {
+ public function __construct(IActivityManager $activityManager,
+ IUserManager $userManager,
+ IUserSession $userSession,
+ IURLGenerator $urlGenerator,
+ IMailer $mailer,
+ IConfig $config,
+ IFactory $languageFactory,
+ IL10N $l) {
$this->activityManager = $activityManager;
$this->userManager = $userManager;
$this->userSession = $userSession;
$this->urlGenerator = $urlGenerator;
$this->mailer = $mailer;
+ $this->config = $config;
+ $this->languageFactory = $languageFactory;
$this->l = $l;
}
@@ -77,6 +92,14 @@ class Hooks {
$actor = $this->userSession->getUser();
if ($actor instanceof IUser) {
if ($actor->getUID() !== $user->getUID()) {
+ $this->l = $this->languageFactory->get(
+ 'settings',
+ $this->config->getUserValue(
+ $user->getUID(), 'core', 'lang',
+ $this->config->getSystemValue('default_language', 'en')
+ )
+ );
+
$text = $this->l->t('%1$s changed your password on %2$s.', [$actor->getDisplayName(), $instanceUrl]);
$event->setAuthor($actor->getUID())
->setSubject(Provider::PASSWORD_CHANGED_BY, [$actor->getUID()]);
@@ -133,6 +156,14 @@ class Hooks {
$actor = $this->userSession->getUser();
if ($actor instanceof IUser) {
if ($actor->getUID() !== $user->getUID()) {
+ $this->l = $this->languageFactory->get(
+ 'settings',
+ $this->config->getUserValue(
+ $user->getUID(), 'core', 'lang',
+ $this->config->getSystemValue('default_language', 'en')
+ )
+ );
+
$text = $this->l->t('%1$s changed your email address on %2$s.', [$actor->getDisplayName(), $instanceUrl]);
$event->setAuthor($actor->getUID())
->setSubject(Provider::EMAIL_CHANGED_BY, [$actor->getUID()]);