diff options
author | Côme Chilliet <come.chilliet@nextcloud.com> | 2022-10-25 17:16:54 +0200 |
---|---|---|
committer | Côme Chilliet (Rebase PR Action) <come-nc@users.noreply.github.com> | 2022-11-29 14:36:29 +0000 |
commit | d9151ff35c4280b8e5bbb92e33fe2b89c2bee458 (patch) | |
tree | c0b5864c0c667156b82763382b4541d1fa073d37 /apps/sharebymail/lib | |
parent | db995d464d06ace8231c41633287ce689b7d33b1 (diff) | |
download | nextcloud-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>
Diffstat (limited to 'apps/sharebymail/lib')
-rw-r--r-- | apps/sharebymail/lib/Activity.php | 93 |
1 files changed, 24 insertions, 69 deletions
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 { |