summaryrefslogtreecommitdiffstats
path: root/settings
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2017-05-26 10:16:14 +0200
committerJoas Schilling <coding@schilljs.com>2017-05-26 10:16:14 +0200
commitcec6ceba9c7f33033db2098584268b1c8f0753a4 (patch)
tree96fd85b54b863a5a9ce0a34bbae55cf00e89e30e /settings
parentc1925ddfd03c6e12874137fb1ba497aad8fc0c41 (diff)
downloadnextcloud-server-cec6ceba9c7f33033db2098584268b1c8f0753a4.tar.gz
nextcloud-server-cec6ceba9c7f33033db2098584268b1c8f0753a4.zip
Use the language of the recipient not the actor
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'settings')
-rw-r--r--settings/Hooks.php33
1 files changed, 32 insertions, 1 deletions
diff --git a/settings/Hooks.php b/settings/Hooks.php
index 2d8b17ebfd9..c8fc9d6a8c3 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()]);
@@ -127,6 +150,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()]);