summaryrefslogtreecommitdiffstats
path: root/apps/dav/lib
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2016-12-01 23:01:00 +0100
committerGitHub <noreply@github.com>2016-12-01 23:01:00 +0100
commitac1bf3c2b7e0a820d68bf50d57f602a01a714d43 (patch)
treecf4e4b8ac856204e9a44001308a6cebecfd06cea /apps/dav/lib
parentea45b220535310f063a4785f2281c96b7c7c2581 (diff)
parentb2f46bfa04fdd6f205fba1a5d4011a9e5c5637dd (diff)
downloadnextcloud-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/dav/lib')
-rw-r--r--apps/dav/lib/CalDAV/Activity/Provider/Calendar.php15
-rw-r--r--apps/dav/lib/CalDAV/Activity/Provider/Event.php15
-rw-r--r--apps/dav/lib/CalDAV/Activity/Provider/Todo.php5
3 files changed, 26 insertions, 9 deletions
diff --git a/apps/dav/lib/CalDAV/Activity/Provider/Calendar.php b/apps/dav/lib/CalDAV/Activity/Provider/Calendar.php
index 2e2ce5bc27a..d7730da61f4 100644
--- a/apps/dav/lib/CalDAV/Activity/Provider/Calendar.php
+++ b/apps/dav/lib/CalDAV/Activity/Provider/Calendar.php
@@ -27,6 +27,7 @@ use OCP\Activity\IManager;
use OCP\IL10N;
use OCP\IURLGenerator;
use OCP\IUserManager;
+use OCP\L10N\IFactory;
class Calendar extends Base {
@@ -38,6 +39,9 @@ class Calendar extends Base {
const SUBJECT_UNSHARE_USER = 'calendar_user_unshare';
const SUBJECT_UNSHARE_GROUP = 'calendar_group_unshare';
+ /** @var IFactory */
+ protected $languageFactory;
+
/** @var IL10N */
protected $l;
@@ -51,32 +55,35 @@ class Calendar extends Base {
protected $eventMerger;
/**
- * @param IL10N $l
+ * @param IFactory $languageFactory
* @param IURLGenerator $url
* @param IManager $activityManager
* @param IUserManager $userManager
* @param IEventMerger $eventMerger
*/
- public function __construct(IL10N $l, IURLGenerator $url, IManager $activityManager, IUserManager $userManager, IEventMerger $eventMerger) {
+ public function __construct(IFactory $languageFactory, IURLGenerator $url, IManager $activityManager, IUserManager $userManager, IEventMerger $eventMerger) {
parent::__construct($userManager);
- $this->l = $l;
+ $this->languageFactory = $languageFactory;
$this->url = $url;
$this->activityManager = $activityManager;
$this->eventMerger = $eventMerger;
}
/**
+ * @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() !== 'dav' || $event->getType() !== 'calendar') {
throw new \InvalidArgumentException();
}
+ $this->l = $this->languageFactory->get('dav', $language);
+
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'places/calendar-dark.svg')));
if ($event->getSubject() === self::SUBJECT_ADD) {
diff --git a/apps/dav/lib/CalDAV/Activity/Provider/Event.php b/apps/dav/lib/CalDAV/Activity/Provider/Event.php
index 11c8d901ac9..daaace6b5be 100644
--- a/apps/dav/lib/CalDAV/Activity/Provider/Event.php
+++ b/apps/dav/lib/CalDAV/Activity/Provider/Event.php
@@ -27,6 +27,7 @@ use OCP\Activity\IManager;
use OCP\IL10N;
use OCP\IURLGenerator;
use OCP\IUserManager;
+use OCP\L10N\IFactory;
class Event extends Base {
@@ -34,6 +35,9 @@ class Event extends Base {
const SUBJECT_OBJECT_UPDATE = 'object_update';
const SUBJECT_OBJECT_DELETE = 'object_delete';
+ /** @var IFactory */
+ protected $languageFactory;
+
/** @var IL10N */
protected $l;
@@ -47,32 +51,35 @@ class Event extends Base {
protected $eventMerger;
/**
- * @param IL10N $l
+ * @param IFactory $languageFactory
* @param IURLGenerator $url
* @param IManager $activityManager
* @param IUserManager $userManager
* @param IEventMerger $eventMerger
*/
- public function __construct(IL10N $l, IURLGenerator $url, IManager $activityManager, IUserManager $userManager, IEventMerger $eventMerger) {
+ public function __construct(IFactory $languageFactory, IURLGenerator $url, IManager $activityManager, IUserManager $userManager, IEventMerger $eventMerger) {
parent::__construct($userManager);
- $this->l = $l;
+ $this->languageFactory = $languageFactory;
$this->url = $url;
$this->activityManager = $activityManager;
$this->eventMerger = $eventMerger;
}
/**
+ * @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() !== 'dav' || $event->getType() !== 'calendar_event') {
throw new \InvalidArgumentException();
}
+ $this->l = $this->languageFactory->get('dav', $language);
+
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'places/calendar-dark.svg')));
if ($event->getSubject() === self::SUBJECT_OBJECT_ADD . '_event') {
diff --git a/apps/dav/lib/CalDAV/Activity/Provider/Todo.php b/apps/dav/lib/CalDAV/Activity/Provider/Todo.php
index 43ab9e9c448..747b39ddb7f 100644
--- a/apps/dav/lib/CalDAV/Activity/Provider/Todo.php
+++ b/apps/dav/lib/CalDAV/Activity/Provider/Todo.php
@@ -26,17 +26,20 @@ use OCP\Activity\IEvent;
class Todo extends Event {
/**
+ * @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() !== 'dav' || $event->getType() !== 'calendar_todo') {
throw new \InvalidArgumentException();
}
+ $this->l = $this->languageFactory->get('dav', $language);
+
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/checkmark.svg')));
if ($event->getSubject() === self::SUBJECT_OBJECT_ADD . '_todo') {