summaryrefslogtreecommitdiffstats
path: root/apps/sharebymail
diff options
context:
space:
mode:
authorCôme Chilliet <91878298+come-nc@users.noreply.github.com>2022-12-19 10:46:39 +0100
committerGitHub <noreply@github.com>2022-12-19 10:46:39 +0100
commitcbbb0712db0f33a41ef66ae59d5c70ba1e23748f (patch)
treedb09b311f4a6a62451dd25db25ae9f8e80a3064c /apps/sharebymail
parent884da19198d15a764487e6a6d615968c0e63203d (diff)
parente553cd1bb9cec6bf6200298bcca6637e81163953 (diff)
downloadnextcloud-server-cbbb0712db0f33a41ef66ae59d5c70ba1e23748f.tar.gz
nextcloud-server-cbbb0712db0f33a41ef66ae59d5c70ba1e23748f.zip
Merge pull request #34807 from nextcloud/fix/compute-notification-parsed-subject
Compute notification parsed subject from rich subject when possible
Diffstat (limited to 'apps/sharebymail')
-rw-r--r--apps/sharebymail/lib/Activity.php93
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 {