summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCôme Chilliet <come.chilliet@nextcloud.com>2022-10-25 17:16:54 +0200
committerCôme Chilliet (Rebase PR Action) <come-nc@users.noreply.github.com>2022-11-29 14:36:29 +0000
commitd9151ff35c4280b8e5bbb92e33fe2b89c2bee458 (patch)
treec0b5864c0c667156b82763382b4541d1fa073d37
parentdb995d464d06ace8231c41633287ce689b7d33b1 (diff)
downloadnextcloud-server-d9151ff35c4280b8e5bbb92e33fe2b89c2bee458.tar.gz
nextcloud-server-d9151ff35c4280b8e5bbb92e33fe2b89c2bee458.zip
Get rid of all useless calls to setParsedSubject now that setRichSubject is able to do it
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
-rw-r--r--apps/comments/lib/Activity/Provider.php12
-rw-r--r--apps/comments/lib/Notification/Notifier.php19
-rw-r--r--apps/dav/lib/CalDAV/Activity/Provider/Base.php18
-rw-r--r--apps/dav/lib/CardDAV/Activity/Provider/Base.php16
-rw-r--r--apps/federatedfilesharing/lib/Notifier.php9
-rw-r--r--apps/files/lib/Activity/FavoriteProvider.php3
-rw-r--r--apps/files/lib/Activity/Provider.php17
-rw-r--r--apps/files/lib/Notification/Notifier.php33
-rw-r--r--apps/files_sharing/lib/Activity/Providers/Base.php20
-rw-r--r--apps/files_sharing/lib/Notification/Notifier.php10
-rw-r--r--apps/settings/lib/Activity/GroupProvider.php13
-rw-r--r--apps/settings/lib/Activity/Provider.php13
-rw-r--r--apps/sharebymail/lib/Activity.php93
-rw-r--r--apps/systemtags/lib/Activity/Provider.php134
-rw-r--r--apps/updatenotification/lib/Notification/Notifier.php16
15 files changed, 87 insertions, 339 deletions
diff --git a/apps/comments/lib/Activity/Provider.php b/apps/comments/lib/Activity/Provider.php
index c6e55326580..f9a5971c7f3 100644
--- a/apps/comments/lib/Activity/Provider.php
+++ b/apps/comments/lib/Activity/Provider.php
@@ -31,12 +31,10 @@ use OCP\Comments\ICommentsManager;
use OCP\Comments\NotFoundException;
use OCP\IL10N;
use OCP\IURLGenerator;
-use OCP\IUser;
use OCP\IUserManager;
use OCP\L10N\IFactory;
class Provider implements IProvider {
-
protected IFactory $languageFactory;
protected ?IL10N $l = null;
protected IUrlGenerator $url;
@@ -97,14 +95,12 @@ class Provider implements IProvider {
if ($event->getSubject() === 'add_comment_subject') {
if ($subjectParameters['actor'] === $this->activityManager->getCurrentUserId()) {
- $event->setParsedSubject($this->l->t('You commented'))
- ->setRichSubject($this->l->t('You commented'), []);
+ $event->setRichSubject($this->l->t('You commented'), []);
} else {
$author = $this->generateUserParameter($subjectParameters['actor']);
- $event->setParsedSubject($this->l->t('%1$s commented', [$author['name']]))
- ->setRichSubject($this->l->t('{author} commented'), [
- 'author' => $author,
- ]);
+ $event->setRichSubject($this->l->t('{author} commented'), [
+ 'author' => $author,
+ ]);
}
} else {
throw new \InvalidArgumentException();
diff --git a/apps/comments/lib/Notification/Notifier.php b/apps/comments/lib/Notification/Notifier.php
index 4ddb7295bfe..59f1ad5da5f 100644
--- a/apps/comments/lib/Notification/Notifier.php
+++ b/apps/comments/lib/Notification/Notifier.php
@@ -29,7 +29,6 @@ use OCP\Comments\ICommentsManager;
use OCP\Comments\NotFoundException;
use OCP\Files\IRootFolder;
use OCP\IURLGenerator;
-use OCP\IUser;
use OCP\IUserManager;
use OCP\L10N\IFactory;
use OCP\Notification\AlreadyProcessedException;
@@ -37,7 +36,6 @@ use OCP\Notification\INotification;
use OCP\Notification\INotifier;
class Notifier implements INotifier {
-
protected IFactory $l10nFactory;
protected IRootFolder $rootFolder;
protected ICommentsManager $commentsManager;
@@ -147,9 +145,7 @@ class Notifier implements INotifier {
}
[$message, $messageParameters] = $this->commentToRichMessage($comment);
$notification->setRichSubject($subject, $subjectParameters)
- ->setParsedSubject($this->richToParsed($subject, $subjectParameters))
->setRichMessage($message, $messageParameters)
- ->setParsedMessage($this->richToParsed($message, $messageParameters))
->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/comment.svg')))
->setLink($this->url->linkToRouteAbsolute(
'comments.Notifications.view',
@@ -205,19 +201,4 @@ class Notifier implements INotifier {
}
return [$message, $messageParameters];
}
-
- public function richToParsed(string $message, array $parameters): string {
- $placeholders = $replacements = [];
- foreach ($parameters as $placeholder => $parameter) {
- $placeholders[] = '{' . $placeholder . '}';
- if ($parameter['type'] === 'user') {
- $replacements[] = '@' . $parameter['name'];
- } elseif ($parameter['type'] === 'file') {
- $replacements[] = $parameter['path'];
- } else {
- $replacements[] = $parameter['name'];
- }
- }
- return str_replace($placeholders, $replacements, $message);
- }
}
diff --git a/apps/dav/lib/CalDAV/Activity/Provider/Base.php b/apps/dav/lib/CalDAV/Activity/Provider/Base.php
index 672129a8311..841011574d0 100644
--- a/apps/dav/lib/CalDAV/Activity/Provider/Base.php
+++ b/apps/dav/lib/CalDAV/Activity/Provider/Base.php
@@ -30,11 +30,9 @@ use OCP\IGroup;
use OCP\IGroupManager;
use OCP\IL10N;
use OCP\IURLGenerator;
-use OCP\IUser;
use OCP\IUserManager;
abstract class Base implements IProvider {
-
/** @var IUserManager */
protected $userManager;
@@ -58,20 +56,8 @@ abstract class Base implements IProvider {
$this->url = $urlGenerator;
}
- /**
- * @param IEvent $event
- * @param string $subject
- * @param array $parameters
- */
- protected function setSubjects(IEvent $event, $subject, array $parameters) {
- $placeholders = $replacements = [];
- foreach ($parameters as $placeholder => $parameter) {
- $placeholders[] = '{' . $placeholder . '}';
- $replacements[] = $parameter['name'];
- }
-
- $event->setParsedSubject(str_replace($placeholders, $replacements, $subject))
- ->setRichSubject($subject, $parameters);
+ protected function setSubjects(IEvent $event, string $subject, array $parameters): void {
+ $event->setRichSubject($subject, $parameters);
}
/**
diff --git a/apps/dav/lib/CardDAV/Activity/Provider/Base.php b/apps/dav/lib/CardDAV/Activity/Provider/Base.php
index 3e7a966c08a..a59c3b57262 100644
--- a/apps/dav/lib/CardDAV/Activity/Provider/Base.php
+++ b/apps/dav/lib/CardDAV/Activity/Provider/Base.php
@@ -32,11 +32,9 @@ use OCP\IGroup;
use OCP\IGroupManager;
use OCP\IL10N;
use OCP\IURLGenerator;
-use OCP\IUser;
use OCP\IUserManager;
abstract class Base implements IProvider {
-
/** @var IUserManager */
protected $userManager;
@@ -60,20 +58,8 @@ abstract class Base implements IProvider {
$this->url = $urlGenerator;
}
- /**
- * @param IEvent $event
- * @param string $subject
- * @param array $parameters
- */
protected function setSubjects(IEvent $event, string $subject, array $parameters): void {
- $placeholders = $replacements = [];
- foreach ($parameters as $placeholder => $parameter) {
- $placeholders[] = '{' . $placeholder . '}';
- $replacements[] = $parameter['name'];
- }
-
- $event->setParsedSubject(str_replace($placeholders, $replacements, $subject))
- ->setRichSubject($subject, $parameters);
+ $event->setRichSubject($subject, $parameters);
}
/**
diff --git a/apps/federatedfilesharing/lib/Notifier.php b/apps/federatedfilesharing/lib/Notifier.php
index 5e57b77b64a..87c05e19e4b 100644
--- a/apps/federatedfilesharing/lib/Notifier.php
+++ b/apps/federatedfilesharing/lib/Notifier.php
@@ -108,10 +108,6 @@ class Notifier implements INotifier {
$params[3] = $remoteInitiator['name'] . '@' . $remoteInitiator['server'];
$params[4] = $remoteOwner['name'] . '@' . $remoteOwner['server'];
- $notification->setParsedSubject(
- $l->t('You received "%3$s" as a remote share from %4$s (%1$s) (on behalf of %5$s (%2$s))', $params)
- );
-
$notification->setRichSubject(
$l->t('You received {share} as a remote share from {user} (on behalf of {behalf})'),
[
@@ -128,11 +124,6 @@ class Notifier implements INotifier {
$remoteOwner = $this->createRemoteUser($params[0]);
$params[3] = $remoteOwner['name'] . '@' . $remoteOwner['server'];
- $notification->setParsedSubject(
- $l->t('You received "%3$s" as a remote share from %4$s (%1$s)', $params)
- );
-
-
$notification->setRichSubject(
$l->t('You received {share} as a remote share from {user}'),
[
diff --git a/apps/files/lib/Activity/FavoriteProvider.php b/apps/files/lib/Activity/FavoriteProvider.php
index a1c08370e4e..9c7018e6a5c 100644
--- a/apps/files/lib/Activity/FavoriteProvider.php
+++ b/apps/files/lib/Activity/FavoriteProvider.php
@@ -172,7 +172,6 @@ class FavoriteProvider implements IProvider {
'link' => $this->url->linkToRouteAbsolute('files.viewcontroller.showFile', ['fileid' => $subjectParams['id']]),
];
- $event->setParsedSubject(str_replace('{file}', $parameter['path'], $subject))
- ->setRichSubject($subject, ['file' => $parameter]);
+ $event->setRichSubject($subject, ['file' => $parameter]);
}
}
diff --git a/apps/files/lib/Activity/Provider.php b/apps/files/lib/Activity/Provider.php
index c21e8f9ad16..2cfd48ede3b 100644
--- a/apps/files/lib/Activity/Provider.php
+++ b/apps/files/lib/Activity/Provider.php
@@ -38,12 +38,10 @@ use OCP\Files\Node;
use OCP\Files\NotFoundException;
use OCP\IL10N;
use OCP\IURLGenerator;
-use OCP\IUser;
use OCP\IUserManager;
use OCP\L10N\IFactory;
class Provider implements IProvider {
-
/** @var IFactory */
protected $languageFactory;
@@ -306,19 +304,8 @@ class Provider implements IProvider {
return strlen($filename) > 0 && $filename[0] === '.';
}
- protected function setSubjects(IEvent $event, $subject, array $parameters) {
- $placeholders = $replacements = [];
- foreach ($parameters as $placeholder => $parameter) {
- $placeholders[] = '{' . $placeholder . '}';
- if ($parameter['type'] === 'file') {
- $replacements[] = $parameter['path'];
- } else {
- $replacements[] = $parameter['name'];
- }
- }
-
- $event->setParsedSubject(str_replace($placeholders, $replacements, $subject))
- ->setRichSubject($subject, $parameters);
+ protected function setSubjects(IEvent $event, string $subject, array $parameters): void {
+ $event->setRichSubject($subject, $parameters);
}
/**
diff --git a/apps/files/lib/Notification/Notifier.php b/apps/files/lib/Notification/Notifier.php
index 1a7a3726229..90784749b27 100644
--- a/apps/files/lib/Notification/Notifier.php
+++ b/apps/files/lib/Notification/Notifier.php
@@ -41,7 +41,6 @@ use OCP\Notification\INotification;
use OCP\Notification\INotifier;
class Notifier implements INotifier, IDismissableNotifier {
-
/** @var IFactory */
protected $l10nFactory;
@@ -151,7 +150,6 @@ class Notifier implements INotifier, IDismissableNotifier {
'name' => $sourceUser->getDisplayName(),
],
])
- ->setParsedSubject(str_replace('{user}', $sourceUser->getDisplayName(), $l->t('Incoming ownership transfer from {user}')))
->setRichMessage(
$l->t("Do you want to accept {path}?\n\nNote: The transfer process after accepting may take up to 1 hour."),
[
@@ -160,20 +158,17 @@ class Notifier implements INotifier, IDismissableNotifier {
'id' => $param['targetUser'] . '::' . $param['nodeName'],
'name' => $param['nodeName'],
]
- ])
- ->setParsedMessage(str_replace('{path}', $param['nodeName'], $l->t("Do you want to accept {path}?\n\nNote: The transfer process after accepting may take up to 1 hour.")));
+ ]);
return $notification;
}
- public function handleTransferOwnershipFailedSource(INotification $notification, string $languageCode): INotification {
+ public function handleTransferOwnershipFailedSource(INotification $notification, string $languageCode): INotification {
$l = $this->l10nFactory->get('files', $languageCode);
$param = $notification->getSubjectParameters();
$targetUser = $this->getUser($param['targetUser']);
$notification->setRichSubject($l->t('Ownership transfer failed'))
- ->setParsedSubject($l->t('Ownership transfer failed'))
-
->setRichMessage(
$l->t('Your ownership transfer of {path} to {user} failed.'),
[
@@ -187,19 +182,16 @@ class Notifier implements INotifier, IDismissableNotifier {
'id' => $targetUser->getUID(),
'name' => $targetUser->getDisplayName(),
],
- ])
- ->setParsedMessage(str_replace(['{path}', '{user}'], [$param['nodeName'], $targetUser->getDisplayName()], $l->t('Your ownership transfer of {path} to {user} failed.')));
+ ]);
return $notification;
}
- public function handleTransferOwnershipFailedTarget(INotification $notification, string $languageCode): INotification {
+ public function handleTransferOwnershipFailedTarget(INotification $notification, string $languageCode): INotification {
$l = $this->l10nFactory->get('files', $languageCode);
$param = $notification->getSubjectParameters();
$sourceUser = $this->getUser($param['sourceUser']);
$notification->setRichSubject($l->t('Ownership transfer failed'))
- ->setParsedSubject($l->t('Ownership transfer failed'))
-
->setRichMessage(
$l->t('The ownership transfer of {path} from {user} failed.'),
[
@@ -213,20 +205,17 @@ class Notifier implements INotifier, IDismissableNotifier {
'id' => $sourceUser->getUID(),
'name' => $sourceUser->getDisplayName(),
],
- ])
- ->setParsedMessage(str_replace(['{path}', '{user}'], [$param['nodeName'], $sourceUser->getDisplayName()], $l->t('The ownership transfer of {path} from {user} failed.')));
+ ]);
return $notification;
}
- public function handleTransferOwnershipDoneSource(INotification $notification, string $languageCode): INotification {
+ public function handleTransferOwnershipDoneSource(INotification $notification, string $languageCode): INotification {
$l = $this->l10nFactory->get('files', $languageCode);
$param = $notification->getSubjectParameters();
$targetUser = $this->getUser($param['targetUser']);
$notification->setRichSubject($l->t('Ownership transfer done'))
- ->setParsedSubject($l->t('Ownership transfer done'))
-
->setRichMessage(
$l->t('Your ownership transfer of {path} to {user} has completed.'),
[
@@ -240,20 +229,17 @@ class Notifier implements INotifier, IDismissableNotifier {
'id' => $targetUser->getUID(),
'name' => $targetUser->getDisplayName(),
],
- ])
- ->setParsedMessage(str_replace(['{path}', '{user}'], [$param['nodeName'], $targetUser->getDisplayName()], $l->t('Your ownership transfer of {path} to {user} has completed.')));
+ ]);
return $notification;
}
- public function handleTransferOwnershipDoneTarget(INotification $notification, string $languageCode): INotification {
+ public function handleTransferOwnershipDoneTarget(INotification $notification, string $languageCode): INotification {
$l = $this->l10nFactory->get('files', $languageCode);
$param = $notification->getSubjectParameters();
$sourceUser = $this->getUser($param['sourceUser']);
$notification->setRichSubject($l->t('Ownership transfer done'))
- ->setParsedSubject($l->t('Ownership transfer done'))
-
->setRichMessage(
$l->t('The ownership transfer of {path} from {user} has completed.'),
[
@@ -267,8 +253,7 @@ class Notifier implements INotifier, IDismissableNotifier {
'id' => $sourceUser->getUID(),
'name' => $sourceUser->getDisplayName(),
],
- ])
- ->setParsedMessage(str_replace(['{path}', '{user}'], [$param['nodeName'], $sourceUser->getDisplayName()], $l->t('The ownership transfer of {path} from {user} has completed.')));
+ ]);
return $notification;
}
diff --git a/apps/files_sharing/lib/Activity/Providers/Base.php b/apps/files_sharing/lib/Activity/Providers/Base.php
index ca5b9b55b62..4a2c6ac919e 100644
--- a/apps/files_sharing/lib/Activity/Providers/Base.php
+++ b/apps/files_sharing/lib/Activity/Providers/Base.php
@@ -31,12 +31,10 @@ use OCP\Contacts\IManager as IContactsManager;
use OCP\Federation\ICloudIdManager;
use OCP\IL10N;
use OCP\IURLGenerator;
-use OCP\IUser;
use OCP\IUserManager;
use OCP\L10N\IFactory;
abstract class Base implements IProvider {
-
/** @var IFactory */
protected $languageFactory;
@@ -124,24 +122,10 @@ abstract class Base implements IProvider {
abstract protected function parseLongVersion(IEvent $event, IEvent $previousEvent = null);
/**
- * @param IEvent $event
- * @param string $subject
- * @param array $parameters
* @throws \InvalidArgumentException
*/
- protected function setSubjects(IEvent $event, $subject, array $parameters) {
- $placeholders = $replacements = [];
- foreach ($parameters as $placeholder => $parameter) {
- $placeholders[] = '{' . $placeholder . '}';
- if ($parameter['type'] === 'file') {
- $replacements[] = $parameter['path'];
- } else {
- $replacements[] = $parameter['name'];
- }
- }
-
- $event->setParsedSubject(str_replace($placeholders, $replacements, $subject))
- ->setRichSubject($subject, $parameters);
+ protected function setSubjects(IEvent $event, string $subject, array $parameters): void {
+ $event->setRichSubject($subject, $parameters);
}
/**
diff --git a/apps/files_sharing/lib/Notification/Notifier.php b/apps/files_sharing/lib/Notification/Notifier.php
index 58f2a60fcdd..455d0fd66fc 100644
--- a/apps/files_sharing/lib/Notification/Notifier.php
+++ b/apps/files_sharing/lib/Notification/Notifier.php
@@ -132,7 +132,6 @@ class Notifier implements INotifier {
$notification
->setParsedSubject($l->t('Share will expire tomorrow'))
- ->setParsedMessage($l->t('One or more of your shares will expire tomorrow'))
->setRichMessage(
$l->t('Your share of {node} will expire tomorrow'),
[
@@ -232,14 +231,7 @@ class Notifier implements INotifier {
throw new \InvalidArgumentException('Invalid subject');
}
- $placeholders = $replacements = [];
- foreach ($subjectParameters as $placeholder => $parameter) {
- $placeholders[] = '{' . $placeholder . '}';
- $replacements[] = $parameter['name'];
- }
-
- $notification->setParsedSubject(str_replace($placeholders, $replacements, $subject))
- ->setRichSubject($subject, $subjectParameters)
+ $notification->setRichSubject($subject, $subjectParameters)
->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg')));
$acceptAction = $notification->createAction();
diff --git a/apps/settings/lib/Activity/GroupProvider.php b/apps/settings/lib/Activity/GroupProvider.php
index 466bb9abeee..52798d2e428 100644
--- a/apps/settings/lib/Activity/GroupProvider.php
+++ b/apps/settings/lib/Activity/GroupProvider.php
@@ -30,7 +30,6 @@ use OCP\Activity\IProvider;
use OCP\IGroup;
use OCP\IGroupManager;
use OCP\IURLGenerator;
-use OCP\IUser;
use OCP\IUserManager;
use OCP\L10N\IFactory as L10nFactory;
@@ -123,20 +122,10 @@ class GroupProvider implements IProvider {
}
/**
- * @param IEvent $event
- * @param string $subject
- * @param array $parameters
* @throws \InvalidArgumentException
*/
protected function setSubjects(IEvent $event, string $subject, array $parameters): void {
- $placeholders = $replacements = [];
- foreach ($parameters as $placeholder => $parameter) {
- $placeholders[] = '{' . $placeholder . '}';
- $replacements[] = $parameter['name'];
- }
-
- $event->setParsedSubject(str_replace($placeholders, $replacements, $subject))
- ->setRichSubject($subject, $parameters);
+ $event->setRichSubject($subject, $parameters);
}
/**
diff --git a/apps/settings/lib/Activity/Provider.php b/apps/settings/lib/Activity/Provider.php
index 7d8a7f0da9a..85ebd3e2abd 100644
--- a/apps/settings/lib/Activity/Provider.php
+++ b/apps/settings/lib/Activity/Provider.php
@@ -33,7 +33,6 @@ use OCP\Activity\IManager;
use OCP\Activity\IProvider;
use OCP\IL10N;
use OCP\IURLGenerator;
-use OCP\IUser;
use OCP\IUserManager;
use OCP\L10N\IFactory;
@@ -186,20 +185,10 @@ class Provider implements IProvider {
}
/**
- * @param IEvent $event
- * @param string $subject
- * @param array $parameters
* @throws \InvalidArgumentException
*/
protected function setSubjects(IEvent $event, string $subject, array $parameters): void {
- $placeholders = $replacements = [];
- foreach ($parameters as $placeholder => $parameter) {
- $placeholders[] = '{' . $placeholder . '}';
- $replacements[] = $parameter['name'];
- }
-
- $event->setParsedSubject(str_replace($placeholders, $replacements, $subject))
- ->setRichSubject($subject, $parameters);
+ $event->setRichSubject($subject, $parameters);
}
protected function generateUserParameter(string $uid): array {
diff --git a/apps/sharebymail/lib/Activity.php b/apps/sharebymail/lib/Activity.php
index 3693455dda4..d1f15eb0e54 100644
--- a/apps/sharebymail/lib/Activity.php
+++ b/apps/sharebymail/lib/Activity.php
@@ -31,12 +31,10 @@ use OCP\Activity\IProvider;
use OCP\Contacts\IManager as IContactsManager;
use OCP\IL10N;
use OCP\IURLGenerator;
-use OCP\IUser;
use OCP\IUserManager;
use OCP\L10N\IFactory;
class Activity implements IProvider {
-
/** @var IFactory */
protected $languageFactory;
@@ -115,72 +113,54 @@ class Activity implements IProvider {
$parsedParameters = $this->getParsedParameters($event);
if ($event->getSubject() === self::SUBJECT_SHARED_EMAIL_SELF) {
- $event->setParsedSubject($this->l->t('Shared with %1$s', [
- $parsedParameters['email']['name'],
- ]))
- ->setRichSubject($this->l->t('Shared with {email}'), [
- 'email' => $parsedParameters['email'],
- ]);
+ $event->setRichSubject($this->l->t('Shared with {email}'), [
+ 'email' => $parsedParameters['email'],
+ ]);
if ($this->activityManager->getRequirePNG()) {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.png')));
} else {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg')));
}
} elseif ($event->getSubject() === self::SUBJECT_SHARED_EMAIL_BY) {
- $event->setParsedSubject($this->l->t('Shared with %1$s by %2$s', [
- $parsedParameters['email']['name'],
- $parsedParameters['actor']['name'],
- ]))
- ->setRichSubject($this->l->t('Shared with {email} by {actor}'), [
- 'email' => $parsedParameters['email'],
- 'actor' => $parsedParameters['actor'],
- ]);
+ $event->setRichSubject($this->l->t('Shared with {email} by {actor}'), [
+ 'email' => $parsedParameters['email'],
+ 'actor' => $parsedParameters['actor'],
+ ]);
if ($this->activityManager->getRequirePNG()) {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.png')));
} else {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg')));
}
} elseif ($event->getSubject() === self::SUBJECT_UNSHARED_EMAIL_SELF) {
- $event->setParsedSubject($this->l->t('Unshared from %1$s', [
- $parsedParameters['email']['name'],
- ]))
- ->setRichSubject($this->l->t('Unshared from {email}'), [
- 'email' => $parsedParameters['email'],
- ]);
+ $event->setRichSubject($this->l->t('Unshared from {email}'), [
+ 'email' => $parsedParameters['email'],
+ ]);
if ($this->activityManager->getRequirePNG()) {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.png')));
} else {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg')));
}
} elseif ($event->getSubject() === self::SUBJECT_UNSHARED_EMAIL_BY) {
- $event->setParsedSubject($this->l->t('Unshared from %1$s by %2$s', [
- $parsedParameters['email']['name'],
- $parsedParameters['actor']['name'],
- ]))
- ->setRichSubject($this->l->t('Unshared from {email} by {actor}'), [
- 'email' => $parsedParameters['email'],
- 'actor' => $parsedParameters['actor'],
- ]);
+ $event->setRichSubject($this->l->t('Unshared from {email} by {actor}'), [
+ 'email' => $parsedParameters['email'],
+ 'actor' => $parsedParameters['actor'],
+ ]);
if ($this->activityManager->getRequirePNG()) {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.png')));
} else {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg')));
}
} elseif ($event->getSubject() === self::SUBJECT_SHARED_EMAIL_PASSWORD_SEND) {
- $event->setParsedSubject($this->l->t('Password for mail share sent to %1$s', [
- $parsedParameters['email']['name']
- ]))
- ->setRichSubject($this->l->t('Password for mail share sent to {email}'), [
- 'email' => $parsedParameters['email']
- ]);
+ $event->setRichSubject($this->l->t('Password for mail share sent to {email}'), [
+ 'email' => $parsedParameters['email']
+ ]);
if ($this->activityManager->getRequirePNG()) {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.png')));
} else {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg')));
}
} elseif ($event->getSubject() === self::SUBJECT_SHARED_EMAIL_PASSWORD_SEND_SELF) {
- $event->setParsedSubject($this->l->t('Password for mail share sent to you'))
- ->setRichSubject($this->l->t('Password for mail share sent to you'));
+ $event->setRichSubject($this->l->t('Password for mail share sent to you'));
if ($this->activityManager->getRequirePNG()) {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.png')));
} else {
@@ -203,67 +183,42 @@ class Activity implements IProvider {
$parsedParameters = $this->getParsedParameters($event);
if ($event->getSubject() === self::SUBJECT_SHARED_EMAIL_SELF) {
- $event->setParsedSubject($this->l->t('You shared %1$s with %2$s by mail', [
- $parsedParameters['file']['path'],
- $parsedParameters['email']['name'],
- ]))
- ->setRichSubject($this->l->t('You shared {file} with {email} by mail'), $parsedParameters);
+ $event->setRichSubject($this->l->t('You shared {file} with {email} by mail'), $parsedParameters);
if ($this->activityManager->getRequirePNG()) {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.png')));
} else {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg')));
}
} elseif ($event->getSubject() === self::SUBJECT_SHARED_EMAIL_BY) {
- $event->setParsedSubject($this->l->t('%3$s shared %1$s with %2$s by mail', [
- $parsedParameters['file']['path'],
- $parsedParameters['email']['name'],
- $parsedParameters['actor']['name'],
- ]))
- ->setRichSubject($this->l->t('{actor} shared {file} with {email} by mail'), $parsedParameters);
+ $event->setRichSubject($this->l->t('{actor} shared {file} with {email} by mail'), $parsedParameters);
if ($this->activityManager->getRequirePNG()) {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.png')));
} else {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg')));
}
} elseif ($event->getSubject() === self::SUBJECT_UNSHARED_EMAIL_SELF) {
- $event->setParsedSubject($this->l->t('You unshared %1$s from %2$s by mail', [
- $parsedParameters['file']['path'],
- $parsedParameters['email']['name'],
- ]))
- ->setRichSubject($this->l->t('You unshared {file} from {email} by mail'), $parsedParameters);
+ $event->setRichSubject($this->l->t('You unshared {file} from {email} by mail'), $parsedParameters);
if ($this->activityManager->getRequirePNG()) {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.png')));
} else {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg')));
}
} elseif ($event->getSubject() === self::SUBJECT_UNSHARED_EMAIL_BY) {
- $event->setParsedSubject($this->l->t('%3$s unshared %1$s from %2$s by mail', [
- $parsedParameters['file']['path'],
- $parsedParameters['email']['name'],
- $parsedParameters['actor']['name'],
- ]))
- ->setRichSubject($this->l->t('{actor} unshared {file} from {email} by mail'), $parsedParameters);
+ $event->setRichSubject($this->l->t('{actor} unshared {file} from {email} by mail'), $parsedParameters);
if ($this->activityManager->getRequirePNG()) {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.png')));
} else {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg')));
}
} elseif ($event->getSubject() === self::SUBJECT_SHARED_EMAIL_PASSWORD_SEND) {
- $event->setParsedSubject($this->l->t('Password to access %1$s was sent to %2s', [
- $parsedParameters['file']['path'],
- $parsedParameters['email']['name']
- ]))
- ->setRichSubject($this->l->t('Password to access {file} was sent to {email}'), $parsedParameters);
+ $event->setRichSubject($this->l->t('Password to access {file} was sent to {email}'), $parsedParameters);
if ($this->activityManager->getRequirePNG()) {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.png')));
} else {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg')));
}
} elseif ($event->getSubject() === self::SUBJECT_SHARED_EMAIL_PASSWORD_SEND_SELF) {
- $event->setParsedSubject(
- $this->l->t('Password to access %1$s was sent to you',
- [$parsedParameters['file']['path']]))
- ->setRichSubject($this->l->t('Password to access {file} was sent to you'), $parsedParameters);
+ $event->setRichSubject($this->l->t('Password to access {file} was sent to you'), $parsedParameters);
if ($this->activityManager->getRequirePNG()) {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.png')));
} else {
diff --git a/apps/systemtags/lib/Activity/Provider.php b/apps/systemtags/lib/Activity/Provider.php
index 16a5687fc81..bb071c4a788 100644
--- a/apps/systemtags/lib/Activity/Provider.php
+++ b/apps/systemtags/lib/Activity/Provider.php
@@ -28,7 +28,6 @@ use OCP\Activity\IManager;
use OCP\Activity\IProvider;
use OCP\IL10N;
use OCP\IURLGenerator;
-use OCP\IUser;
use OCP\IUserManager;
use OCP\L10N\IFactory;
@@ -111,53 +110,33 @@ class Provider implements IProvider {
if ($event->getSubject() === self::ASSIGN_TAG) {
if ($parsedParameters['actor']['id'] === '') {
- $event->setParsedSubject($this->l->t('System tag %1$s added by the system', [
- $this->generatePlainSystemTag($parsedParameters['systemtag']),
- ]))
- ->setRichSubject($this->l->t('Added system tag {systemtag}'), [
- 'systemtag' => $parsedParameters['systemtag'],
- ]);
+ $event->setRichSubject($this->l->t('Added system tag {systemtag}'), [
+ 'systemtag' => $parsedParameters['systemtag'],
+ ]);
} elseif ($parsedParameters['actor']['id'] === $this->activityManager->getCurrentUserId()) {
- $event->setParsedSubject($this->l->t('Added system tag %1$s', [
- $this->generatePlainSystemTag($parsedParameters['systemtag']),
- ]))
- ->setRichSubject($this->l->t('Added system tag {systemtag}'), [
- 'systemtag' => $parsedParameters['systemtag'],
- ]);
+ $event->setRichSubject($this->l->t('Added system tag {systemtag}'), [
+ 'systemtag' => $parsedParameters['systemtag'],
+ ]);
} else {
- $event->setParsedSubject($this->l->t('%1$s added system tag %2$s', [
- $parsedParameters['actor']['name'],
- $this->generatePlainSystemTag($parsedParameters['systemtag']),
- ]))
- ->setRichSubject($this->l->t('{actor} added system tag {systemtag}'), [
- 'actor' => $parsedParameters['actor'],
- 'systemtag' => $parsedParameters['systemtag'],
- ]);
+ $event->setRichSubject($this->l->t('{actor} added system tag {systemtag}'), [
+ 'actor' => $parsedParameters['actor'],
+ 'systemtag' => $parsedParameters['systemtag'],
+ ]);
}
} elseif ($event->getSubject() === self::UNASSIGN_TAG) {
if ($parsedParameters['actor']['id'] === '') {
- $event->setParsedSubject($this->l->t('System tag %1$s removed by the system', [
- $this->generatePlainSystemTag($parsedParameters['systemtag']),
- ]))
- ->setRichSubject($this->l->t('Removed system tag {systemtag}'), [
- 'systemtag' => $parsedParameters['systemtag'],
- ]);
+ $event->setRichSubject($this->l->t('Removed system tag {systemtag}'), [
+ 'systemtag' => $parsedParameters['systemtag'],
+ ]);
} elseif ($parsedParameters['actor']['id'] === $this->activityManager->getCurrentUserId()) {
- $event->setParsedSubject($this->l->t('Removed system tag %1$s', [
- $this->generatePlainSystemTag($parsedParameters['systemtag']),
- ]))
- ->setRichSubject($this->l->t('Removed system tag {systemtag}'), [
- 'systemtag' => $parsedParameters['systemtag'],
- ]);
+ $event->setRichSubject($this->l->t('Removed system tag {systemtag}'), [
+ 'systemtag' => $parsedParameters['systemtag'],
+ ]);
} else {
- $event->setParsedSubject($this->l->t('%1$s removed system tag %2$s', [
- $parsedParameters['actor']['name'],
- $this->generatePlainSystemTag($parsedParameters['systemtag']),
- ]))
- ->setRichSubject($this->l->t('{actor} removed system tag {systemtag}'), [
- 'actor' => $parsedParameters['actor'],
- 'systemtag' => $parsedParameters['systemtag'],
- ]);
+ $event->setRichSubject($this->l->t('{actor} removed system tag {systemtag}'), [
+ 'actor' => $parsedParameters['actor'],
+ 'systemtag' => $parsedParameters['systemtag'],
+ ]);
}
} else {
throw new \InvalidArgumentException();
@@ -183,88 +162,39 @@ class Provider implements IProvider {
if ($event->getSubject() === self::CREATE_TAG) {
if ($parsedParameters['actor']['id'] === $this->activityManager->getCurrentUserId()) {
- $event->setParsedSubject($this->l->t('You created system tag %1$s', [
- $this->generatePlainSystemTag($parsedParameters['systemtag']),
- ]))
- ->setRichSubject($this->l->t('You created system tag {systemtag}'), $parsedParameters);
+ $event->setRichSubject($this->l->t('You created system tag {systemtag}'), $parsedParameters);
} else {
- $event->setParsedSubject($this->l->t('%1$s created system tag %2$s', [
- $parsedParameters['actor']['name'],
- $this->generatePlainSystemTag($parsedParameters['systemtag']),
- ]))
- ->setRichSubject($this->l->t('{actor} created system tag {systemtag}'), $parsedParameters);
+ $event->setRichSubject($this->l->t('{actor} created system tag {systemtag}'), $parsedParameters);
}
} elseif ($event->getSubject() === self::DELETE_TAG) {
if ($parsedParameters['actor']['id'] === $this->activityManager->getCurrentUserId()) {
- $event->setParsedSubject($this->l->t('You deleted system tag %1$s', [
- $this->generatePlainSystemTag($parsedParameters['systemtag']),
- ]))
- ->setRichSubject($this->l->t('You deleted system tag {systemtag}'), $parsedParameters);
+ $event->setRichSubject($this->l->t('You deleted system tag {systemtag}'), $parsedParameters);
} else {
- $event->setParsedSubject($this->l->t('%1$s deleted system tag %2$s', [
- $parsedParameters['actor']['name'],
- $this->generatePlainSystemTag($parsedParameters['systemtag']),
- ]))
- ->setRichSubject($this->l->t('{actor} deleted system tag {systemtag}'), $parsedParameters);
+ $event->setRichSubject($this->l->t('{actor} deleted system tag {systemtag}'), $parsedParameters);
}
} elseif ($event->getSubject() === self::UPDATE_TAG) {
if ($parsedParameters['actor']['id'] === $this->activityManager->getCurrentUserId()) {
- $event->setParsedSubject($this->l->t('You updated system tag %2$s to %1$s', [
- $this->generatePlainSystemTag($parsedParameters['newsystemtag']),
- $this->generatePlainSystemTag($parsedParameters['oldsystemtag']),
- ]))
- ->setRichSubject($this->l->t('You updated system tag {oldsystemtag} to {newsystemtag}'), $parsedParameters);
+ $event->setRichSubject($this->l->t('You updated system tag {oldsystemtag} to {newsystemtag}'), $parsedParameters);
} else {
- $event->setParsedSubject($this->l->t('%1$s updated system tag %3$s to %2$s', [
- $parsedParameters['actor']['name'],
- $this->generatePlainSystemTag($parsedParameters['newsystemtag']),
- $this->generatePlainSystemTag($parsedParameters['oldsystemtag']),
- ]))
- ->setRichSubject($this->l->t('{actor} updated system tag {oldsystemtag} to {newsystemtag}'), $parsedParameters);
+ $event->setRichSubject($this->l->t('{actor} updated system tag {oldsystemtag} to {newsystemtag}'), $parsedParameters);
}
} elseif ($event->getSubject() === self::ASSIGN_TAG) {
if ($parsedParameters['actor']['id'] === '') {
unset($parsedParameters['actor']);
- $event->setParsedSubject($this->l->t('System tag %2$s was added to %1$s by the system', [
- $parsedParameters['file']['path'],
- $this->generatePlainSystemTag($parsedParameters['systemtag']),
- ]))
- ->setRichSubject($this->l->t('System tag {systemtag} was added to {file} by the system'), $parsedParameters);
+ $event->setRichSubject($this->l->t('System tag {systemtag} was added to {file} by the system'), $parsedParameters);
} elseif ($parsedParameters['actor']['id'] === $this->activityManager->getCurrentUserId()) {
- $event->setParsedSubject($this->l->t('You added system tag %2$s to %1$s', [
- $parsedParameters['file']['path'],
- $this->generatePlainSystemTag($parsedParameters['systemtag']),
- ]))
- ->setRichSubject($this->l->t('You added system tag {systemtag} to {file}'), $parsedParameters);
+ $event->setRichSubject($this->l->t('You added system tag {systemtag} to {file}'), $parsedParameters);
} else {
- $event->setParsedSubject($this->l->t('%1$s added system tag %3$s to %2$s', [
- $parsedParameters['actor']['name'],
- $parsedParameters['file']['path'],
- $this->generatePlainSystemTag($parsedParameters['systemtag']),
- ]))
- ->setRichSubject($this->l->t('{actor} added system tag {systemtag} to {file}'), $parsedParameters);
+ $event->setRichSubject($this->l->t('{actor} added system tag {systemtag} to {file}'), $parsedParameters);
}
} elseif ($event->getSubject() === self::UNASSIGN_TAG) {
if ($parsedParameters['actor']['id'] === '') {
unset($parsedParameters['actor']);
- $event->setParsedSubject($this->l->t('System tag %2$s was removed from %1$s by the system', [
- $parsedParameters['file']['path'],
- $this->generatePlainSystemTag($parsedParameters['systemtag']),
- ]))
- ->setRichSubject($this->l->t('System tag {systemtag} was removed from {file} by the system'), $parsedParameters);
+ $event->setRichSubject($this->l->t('System tag {systemtag} was removed from {file} by the system'), $parsedParameters);
} elseif ($parsedParameters['actor']['id'] === $this->activityManager->getCurrentUserId()) {
- $event->setParsedSubject($this->l->t('You removed system tag %2$s from %1$s', [
- $parsedParameters['file']['path'],
- $this->generatePlainSystemTag($parsedParameters['systemtag']),
- ]))
- ->setRichSubject($this->l->t('You removed system tag {systemtag} from {file}'), $parsedParameters);
+ $event->setRichSubject($this->l->t('You removed system tag {systemtag} from {file}'), $parsedParameters);
} else {
- $event->setParsedSubject($this->l->t('%1$s removed system tag %3$s from %2$s', [
- $parsedParameters['actor']['name'],
- $parsedParameters['file']['path'],
- $this->generatePlainSystemTag($parsedParameters['systemtag']),
- ]))
- ->setRichSubject($this->l->t('{actor} removed system tag {systemtag} from {file}'), $parsedParameters);
+ $event->setRichSubject($this->l->t('{actor} removed system tag {systemtag} from {file}'), $parsedParameters);
}
} else {
throw new \InvalidArgumentException();
diff --git a/apps/updatenotification/lib/Notification/Notifier.php b/apps/updatenotification/lib/Notification/Notifier.php
index bfbcc203480..abba20f993b 100644
--- a/apps/updatenotification/lib/Notification/Notifier.php
+++ b/apps/updatenotification/lib/Notification/Notifier.php
@@ -39,7 +39,6 @@ use OCP\Notification\INotifier;
use OCP\Util;
class Notifier implements INotifier {
-
/** @var IURLGenerator */
protected $url;
@@ -141,14 +140,13 @@ class Notifier implements INotifier {
$this->updateAlreadyInstalledCheck($notification, $this->appVersions[$notification->getObjectType()]);
}
- $notification->setParsedSubject($l->t('Update for %1$s to version %2$s is available.', [$appName, $notification->getObjectId()]))
- ->setRichSubject($l->t('Update for {app} to version %s is available.', [$notification->getObjectId()]), [
- 'app' => [
- 'type' => 'app',
- 'id' => $notification->getObjectType(),
- 'name' => $appName,
- ]
- ]);
+ $notification->setRichSubject($l->t('Update for {app} to version %s is available.', [$notification->getObjectId()]), [
+ 'app' => [
+ 'type' => 'app',
+ 'id' => $notification->getObjectType(),
+ 'name' => $appName,
+ ]
+ ]);
if ($this->isAdmin()) {
$notification->setLink($this->url->linkToRouteAbsolute('settings.AppSettings.viewApps', ['category' => 'updates']) . '#app-' . $notification->getObjectType());