diff options
author | Morris Jobke <hey@morrisjobke.de> | 2016-12-01 23:01:00 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-01 23:01:00 +0100 |
commit | ac1bf3c2b7e0a820d68bf50d57f602a01a714d43 (patch) | |
tree | cf4e4b8ac856204e9a44001308a6cebecfd06cea /apps/files_sharing | |
parent | ea45b220535310f063a4785f2281c96b7c7c2581 (diff) | |
parent | b2f46bfa04fdd6f205fba1a5d4011a9e5c5637dd (diff) | |
download | nextcloud-server-ac1bf3c2b7e0a820d68bf50d57f602a01a714d43.tar.gz nextcloud-server-ac1bf3c2b7e0a820d68bf50d57f602a01a714d43.zip |
Merge pull request #2432 from nextcloud/activity-mail-language
Make sure the activity emails can be sent in the users language
Diffstat (limited to 'apps/files_sharing')
5 files changed, 55 insertions, 22 deletions
diff --git a/apps/files_sharing/lib/Activity/Providers/Downloads.php b/apps/files_sharing/lib/Activity/Providers/Downloads.php index 39e2a846b30..e1a25156441 100644 --- a/apps/files_sharing/lib/Activity/Providers/Downloads.php +++ b/apps/files_sharing/lib/Activity/Providers/Downloads.php @@ -26,9 +26,13 @@ use OCP\Activity\IManager; use OCP\Activity\IProvider; use OCP\IL10N; use OCP\IURLGenerator; +use OCP\L10N\IFactory; class Downloads implements IProvider { + /** @var IFactory */ + protected $languageFactory; + /** @var IL10N */ protected $l; @@ -45,28 +49,31 @@ class Downloads implements IProvider { const SUBJECT_SHARED_FOLDER_BY_EMAIL_DOWNLOADED = 'folder_shared_with_email_downloaded'; /** - * @param IL10N $l + * @param IFactory $languageFactory * @param IURLGenerator $url * @param IManager $activityManager */ - public function __construct(IL10N $l, IURLGenerator $url, IManager $activityManager) { - $this->l = $l; + public function __construct(IFactory $languageFactory, IURLGenerator $url, IManager $activityManager) { + $this->languageFactory = $languageFactory; $this->url = $url; $this->activityManager = $activityManager; } /** + * @param string $language * @param IEvent $event * @param IEvent|null $previousEvent * @return IEvent * @throws \InvalidArgumentException * @since 11.0.0 */ - public function parse(IEvent $event, IEvent $previousEvent = null) { + public function parse($language, IEvent $event, IEvent $previousEvent = null) { if ($event->getApp() !== 'files_sharing') { throw new \InvalidArgumentException(); } + $this->l = $this->languageFactory->get('files_sharing', $language); + if ($this->activityManager->isFormattingFilteredObject()) { try { return $this->parseShortVersion($event); diff --git a/apps/files_sharing/lib/Activity/Providers/Groups.php b/apps/files_sharing/lib/Activity/Providers/Groups.php index c42cc1bb59b..326ebba9ef7 100644 --- a/apps/files_sharing/lib/Activity/Providers/Groups.php +++ b/apps/files_sharing/lib/Activity/Providers/Groups.php @@ -28,9 +28,13 @@ use OCP\IL10N; use OCP\IURLGenerator; use OCP\IUser; use OCP\IUserManager; +use OCP\L10N\IFactory; class Groups implements IProvider { + /** @var IFactory */ + protected $languageFactory; + /** @var IL10N */ protected $l; @@ -53,30 +57,33 @@ class Groups implements IProvider { /** - * @param IL10N $l + * @param IFactory $languageFactory * @param IURLGenerator $url * @param IManager $activityManager * @param IUserManager $userManager */ - public function __construct(IL10N $l, IURLGenerator $url, IManager $activityManager, IUserManager $userManager) { - $this->l = $l; + public function __construct(IFactory $languageFactory, IURLGenerator $url, IManager $activityManager, IUserManager $userManager) { + $this->languageFactory = $languageFactory; $this->url = $url; $this->activityManager = $activityManager; $this->userManager = $userManager; } /** + * @param string $language * @param IEvent $event * @param IEvent|null $previousEvent * @return IEvent * @throws \InvalidArgumentException * @since 11.0.0 */ - public function parse(IEvent $event, IEvent $previousEvent = null) { + public function parse($language, IEvent $event, IEvent $previousEvent = null) { if ($event->getApp() !== 'files_sharing') { throw new \InvalidArgumentException(); } + $this->l = $this->languageFactory->get('files_sharing', $language); + if ($this->activityManager->isFormattingFilteredObject()) { try { return $this->parseShortVersion($event); diff --git a/apps/files_sharing/lib/Activity/Providers/PublicLinks.php b/apps/files_sharing/lib/Activity/Providers/PublicLinks.php index a1c6333a86b..ec8152c5a32 100644 --- a/apps/files_sharing/lib/Activity/Providers/PublicLinks.php +++ b/apps/files_sharing/lib/Activity/Providers/PublicLinks.php @@ -28,9 +28,13 @@ use OCP\IL10N; use OCP\IURLGenerator; use OCP\IUser; use OCP\IUserManager; +use OCP\L10N\IFactory; class PublicLinks implements IProvider { + /** @var IFactory */ + protected $languageFactory; + /** @var IL10N */ protected $l; @@ -55,30 +59,33 @@ class PublicLinks implements IProvider { /** - * @param IL10N $l + * @param IFactory $languageFactory * @param IURLGenerator $url * @param IManager $activityManager * @param IUserManager $userManager */ - public function __construct(IL10N $l, IURLGenerator $url, IManager $activityManager, IUserManager $userManager) { - $this->l = $l; + public function __construct(IFactory $languageFactory, IURLGenerator $url, IManager $activityManager, IUserManager $userManager) { + $this->languageFactory = $languageFactory; $this->url = $url; $this->activityManager = $activityManager; $this->userManager = $userManager; } /** + * @param string $language * @param IEvent $event * @param IEvent|null $previousEvent * @return IEvent * @throws \InvalidArgumentException * @since 11.0.0 */ - public function parse(IEvent $event, IEvent $previousEvent = null) { + public function parse($language, IEvent $event, IEvent $previousEvent = null) { if ($event->getApp() !== 'files_sharing') { throw new \InvalidArgumentException(); } + $this->l = $this->languageFactory->get('files_sharing', $language); + if ($this->activityManager->isFormattingFilteredObject()) { try { return $this->parseShortVersion($event); diff --git a/apps/files_sharing/lib/Activity/Providers/RemoteShares.php b/apps/files_sharing/lib/Activity/Providers/RemoteShares.php index 8760733a261..3ee5d82e932 100644 --- a/apps/files_sharing/lib/Activity/Providers/RemoteShares.php +++ b/apps/files_sharing/lib/Activity/Providers/RemoteShares.php @@ -26,11 +26,13 @@ use OCP\Activity\IManager; use OCP\Activity\IProvider; use OCP\IL10N; use OCP\IURLGenerator; -use OCP\IUser; -use OCP\IUserManager; +use OCP\L10N\IFactory; class RemoteShares implements IProvider { + /** @var IFactory */ + protected $languageFactory; + /** @var IL10N */ protected $l; @@ -46,28 +48,31 @@ class RemoteShares implements IProvider { const SUBJECT_REMOTE_SHARE_UNSHARED = 'remote_share_unshared'; /** - * @param IL10N $l + * @param IFactory $languageFactory * @param IURLGenerator $url * @param IManager $activityManager */ - public function __construct(IL10N $l, IURLGenerator $url, IManager $activityManager) { - $this->l = $l; + public function __construct(IFactory $languageFactory, IURLGenerator $url, IManager $activityManager) { + $this->languageFactory = $languageFactory; $this->url = $url; $this->activityManager = $activityManager; } /** + * @param string $language * @param IEvent $event * @param IEvent|null $previousEvent * @return IEvent * @throws \InvalidArgumentException * @since 11.0.0 */ - public function parse(IEvent $event, IEvent $previousEvent = null) { + public function parse($language, IEvent $event, IEvent $previousEvent = null) { if ($event->getApp() !== 'files_sharing') { throw new \InvalidArgumentException(); } + $this->l = $this->languageFactory->get('files_sharing', $language); + if ($this->activityManager->isFormattingFilteredObject()) { try { return $this->parseShortVersion($event); diff --git a/apps/files_sharing/lib/Activity/Providers/Users.php b/apps/files_sharing/lib/Activity/Providers/Users.php index c85452aec06..d85eeadc315 100644 --- a/apps/files_sharing/lib/Activity/Providers/Users.php +++ b/apps/files_sharing/lib/Activity/Providers/Users.php @@ -28,9 +28,13 @@ use OCP\IL10N; use OCP\IURLGenerator; use OCP\IUser; use OCP\IUserManager; +use OCP\L10N\IFactory; class Users implements IProvider { + /** @var IFactory */ + protected $languageFactory; + /** @var IL10N */ protected $l; @@ -55,30 +59,33 @@ class Users implements IProvider { const SUBJECT_UNSHARED_BY = 'unshared_by'; /** - * @param IL10N $l + * @param IFactory $languageFactory * @param IURLGenerator $url * @param IManager $activityManager * @param IUserManager $userManager */ - public function __construct(IL10N $l, IURLGenerator $url, IManager $activityManager, IUserManager $userManager) { - $this->l = $l; + public function __construct(IFactory $languageFactory, IURLGenerator $url, IManager $activityManager, IUserManager $userManager) { + $this->languageFactory = $languageFactory; $this->url = $url; $this->activityManager = $activityManager; $this->userManager = $userManager; } /** + * @param string $language * @param IEvent $event * @param IEvent|null $previousEvent * @return IEvent * @throws \InvalidArgumentException * @since 11.0.0 */ - public function parse(IEvent $event, IEvent $previousEvent = null) { + public function parse($language, IEvent $event, IEvent $previousEvent = null) { if ($event->getApp() !== 'files_sharing') { throw new \InvalidArgumentException(); } + $this->l = $this->languageFactory->get('files_sharing', $language); + if ($this->activityManager->isFormattingFilteredObject()) { try { return $this->parseShortVersion($event); |