Merge pull request #2432 from nextcloud/activity-mail-language
Make sure the activity emails can be sent in the users language
This commit is contained in:
commit
ac1bf3c2b7
|
@ -30,9 +30,13 @@ use OCP\IL10N;
|
|||
use OCP\IURLGenerator;
|
||||
use OCP\IUser;
|
||||
use OCP\IUserManager;
|
||||
use OCP\L10N\IFactory;
|
||||
|
||||
class Provider implements IProvider {
|
||||
|
||||
/** @var IFactory */
|
||||
protected $languageFactory;
|
||||
|
||||
/** @var IL10N */
|
||||
protected $l;
|
||||
|
||||
|
@ -52,14 +56,14 @@ class Provider implements IProvider {
|
|||
protected $displayNames = [];
|
||||
|
||||
/**
|
||||
* @param IL10N $l
|
||||
* @param IFactory $languageFactory
|
||||
* @param IURLGenerator $url
|
||||
* @param ICommentsManager $commentsManager
|
||||
* @param IUserManager $userManager
|
||||
* @param IManager $activityManager
|
||||
*/
|
||||
public function __construct(IL10N $l, IURLGenerator $url, ICommentsManager $commentsManager, IUserManager $userManager, IManager $activityManager) {
|
||||
$this->l = $l;
|
||||
public function __construct(IFactory $languageFactory, IURLGenerator $url, ICommentsManager $commentsManager, IUserManager $userManager, IManager $activityManager) {
|
||||
$this->languageFactory = $languageFactory;
|
||||
$this->url = $url;
|
||||
$this->commentsManager = $commentsManager;
|
||||
$this->userManager = $userManager;
|
||||
|
@ -67,17 +71,20 @@ class Provider implements IProvider {
|
|||
}
|
||||
|
||||
/**
|
||||
* @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() !== 'comments') {
|
||||
throw new \InvalidArgumentException();
|
||||
}
|
||||
|
||||
$this->l = $this->languageFactory->get('comments', $language);
|
||||
|
||||
if ($event->getSubject() === 'add_comment_subject') {
|
||||
$this->parseMessage($event);
|
||||
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/comment.svg')));
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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') {
|
||||
|
|
|
@ -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') {
|
||||
|
|
|
@ -29,9 +29,13 @@ use OCP\IL10N;
|
|||
use OCP\IURLGenerator;
|
||||
use OCP\IUser;
|
||||
use OCP\IUserManager;
|
||||
use OCP\L10N\IFactory;
|
||||
|
||||
class Provider implements IProvider {
|
||||
|
||||
/** @var IFactory */
|
||||
protected $languageFactory;
|
||||
|
||||
/** @var IL10N */
|
||||
protected $l;
|
||||
|
||||
|
@ -51,14 +55,14 @@ class Provider implements IProvider {
|
|||
protected $displayNames = [];
|
||||
|
||||
/**
|
||||
* @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) {
|
||||
$this->l = $l;
|
||||
public function __construct(IFactory $languageFactory, IURLGenerator $url, IManager $activityManager, IUserManager $userManager, IEventMerger $eventMerger) {
|
||||
$this->languageFactory = $languageFactory;
|
||||
$this->url = $url;
|
||||
$this->activityManager = $activityManager;
|
||||
$this->userManager = $userManager;
|
||||
|
@ -66,17 +70,20 @@ class Provider implements IProvider {
|
|||
}
|
||||
|
||||
/**
|
||||
* @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') {
|
||||
throw new \InvalidArgumentException();
|
||||
}
|
||||
|
||||
$this->l = $this->languageFactory->get('files', $language);
|
||||
|
||||
if ($this->activityManager->isFormattingFilteredObject()) {
|
||||
try {
|
||||
return $this->parseShortVersion($event, $previousEvent);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -29,9 +29,13 @@ use OCP\IL10N;
|
|||
use OCP\IURLGenerator;
|
||||
use OCP\IUser;
|
||||
use OCP\IUserManager;
|
||||
use OCP\L10N\IFactory;
|
||||
|
||||
class Activity implements IProvider {
|
||||
|
||||
/** @var IFactory */
|
||||
protected $languageFactory;
|
||||
|
||||
/** @var IL10N */
|
||||
protected $l;
|
||||
|
||||
|
@ -56,14 +60,14 @@ class Activity implements IProvider {
|
|||
const SUBJECT_SHARED_EMAIL_BY = 'shared_with_email_by';
|
||||
|
||||
/**
|
||||
* @param IL10N $l
|
||||
* @param IFactory $languageFactory
|
||||
* @param IURLGenerator $url
|
||||
* @param IManager $activityManager
|
||||
* @param IUserManager $userManager
|
||||
* @param IContactsManager $contactsManager
|
||||
*/
|
||||
public function __construct(IL10N $l, IURLGenerator $url, IManager $activityManager, IUserManager $userManager, IContactsManager $contactsManager) {
|
||||
$this->l = $l;
|
||||
public function __construct(IFactory $languageFactory, IURLGenerator $url, IManager $activityManager, IUserManager $userManager, IContactsManager $contactsManager) {
|
||||
$this->languageFactory = $languageFactory;
|
||||
$this->url = $url;
|
||||
$this->activityManager = $activityManager;
|
||||
$this->userManager = $userManager;
|
||||
|
@ -71,17 +75,20 @@ class Activity implements IProvider {
|
|||
}
|
||||
|
||||
/**
|
||||
* @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() !== 'sharebymail') {
|
||||
throw new \InvalidArgumentException();
|
||||
}
|
||||
|
||||
$this->l = $this->languageFactory->get('sharebymail', $language);
|
||||
|
||||
if ($this->activityManager->isFormattingFilteredObject()) {
|
||||
try {
|
||||
return $this->parseShortVersion($event);
|
||||
|
|
|
@ -28,6 +28,7 @@ use OCP\IL10N;
|
|||
use OCP\IURLGenerator;
|
||||
use OCP\IUser;
|
||||
use OCP\IUserManager;
|
||||
use OCP\L10N\IFactory;
|
||||
|
||||
class Provider implements IProvider {
|
||||
|
||||
|
@ -38,6 +39,9 @@ class Provider implements IProvider {
|
|||
const ASSIGN_TAG = 'assign_tag';
|
||||
const UNASSIGN_TAG = 'unassign_tag';
|
||||
|
||||
/** @var IFactory */
|
||||
protected $languageFactory;
|
||||
|
||||
/** @var IL10N */
|
||||
protected $l;
|
||||
|
||||
|
@ -54,30 +58,33 @@ class Provider implements IProvider {
|
|||
protected $displayNames = [];
|
||||
|
||||
/**
|
||||
* @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() !== 'systemtags') {
|
||||
throw new \InvalidArgumentException();
|
||||
}
|
||||
|
||||
$this->l = $this->languageFactory->get('systemtags', $language);
|
||||
|
||||
if ($this->activityManager->isFormattingFilteredObject()) {
|
||||
try {
|
||||
return $this->parseShortVersion($event);
|
||||
|
|
|
@ -29,11 +29,14 @@ namespace OCP\Activity;
|
|||
*/
|
||||
interface IProvider {
|
||||
/**
|
||||
* @param IEvent $event
|
||||
* @param IEvent|null $previousEvent
|
||||
* @param string $language The language which should be used for translating, e.g. "en"
|
||||
* @param IEvent $event The current event which should be parsed
|
||||
* @param IEvent|null $previousEvent A potential previous event which you can combine with the current one.
|
||||
* To do so, simply use setChildEvent($previousEvent) after setting the
|
||||
* combined subject on the current event.
|
||||
* @return IEvent
|
||||
* @throws \InvalidArgumentException
|
||||
* @throws \InvalidArgumentException Should be thrown if your provider does not know this event
|
||||
* @since 11.0.0
|
||||
*/
|
||||
public function parse(IEvent $event, IEvent $previousEvent = null);
|
||||
public function parse($language, IEvent $event, IEvent $previousEvent = null);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue