summaryrefslogtreecommitdiffstats
path: root/apps/sharebymail/lib/Activity.php
diff options
context:
space:
mode:
authorBjoern Schiessle <bjoern@schiessle.org>2017-04-19 15:10:22 +0200
committerBjoern Schiessle <bjoern@schiessle.org>2017-04-20 16:33:26 +0200
commitf00c1eccf714379df8ffa316481967e5a0e993fb (patch)
tree00989c31e8b2a1af84924db42ff7351bcbf65c14 /apps/sharebymail/lib/Activity.php
parentf0651cb06601dda528c14a538c18c5484b7c6ef8 (diff)
downloadnextcloud-server-f00c1eccf714379df8ffa316481967e5a0e993fb.tar.gz
nextcloud-server-f00c1eccf714379df8ffa316481967e5a0e993fb.zip
create activity if a password was send by mail
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
Diffstat (limited to 'apps/sharebymail/lib/Activity.php')
-rw-r--r--apps/sharebymail/lib/Activity.php52
1 files changed, 44 insertions, 8 deletions
diff --git a/apps/sharebymail/lib/Activity.php b/apps/sharebymail/lib/Activity.php
index 1c2f37dc382..acc3e59f923 100644
--- a/apps/sharebymail/lib/Activity.php
+++ b/apps/sharebymail/lib/Activity.php
@@ -58,6 +58,8 @@ class Activity implements IProvider {
const SUBJECT_SHARED_EMAIL_SELF = 'shared_with_email_self';
const SUBJECT_SHARED_EMAIL_BY = 'shared_with_email_by';
+ const SUBJECT_SHARED_EMAIL_PASSWORD_SEND = 'shared_with_email_password_send';
+ const SUBJECT_SHARED_EMAIL_PASSWORD_SEND_SELF = 'shared_with_email_password_send_self';
/**
* @param IFactory $languageFactory
@@ -119,15 +121,26 @@ class Activity implements IProvider {
->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg')));
} else if ($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'],
- ]))
+ $parsedParameters['email']['name'],
+ $parsedParameters['actor']['name'],
+ ]))
->setRichSubject($this->l->t('Shared with {email} by {actor}'), [
'email' => $parsedParameters['email'],
'actor' => $parsedParameters['actor'],
])
->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg')));
-
+ } else if ($event->getSubject() === self::SUBJECT_SHARED_EMAIL_PASSWORD_SEND) {
+ $event->setParsedSubject($this->l->t('Password for mail share send to %1$s', [
+ $parsedParameters['email']['name']
+ ]))
+ ->setRichSubject($this->l->t('Password for mail share send to {email}'), [
+ 'email' => $parsedParameters['email']
+ ])
+ ->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg')));
+ } else if ($event->getSubject() === self::SUBJECT_SHARED_EMAIL_PASSWORD_SEND_SELF) {
+ $event->setParsedSubject($this->l->t('Password for mail share send to you'))
+ ->setRichSubject($this->l->t('Password for mail share send to you'))
+ ->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg')));
} else {
throw new \InvalidArgumentException();
}
@@ -153,12 +166,26 @@ class Activity implements IProvider {
->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg')));
} else if ($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'],
- ]))
+ $parsedParameters['file']['path'],
+ $parsedParameters['email']['name'],
+ $parsedParameters['actor']['name'],
+ ]))
->setRichSubject($this->l->t('{actor} shared {file} with {email} by mail'), $parsedParameters)
->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg')));
+ } else if ($event->getSubject() === self::SUBJECT_SHARED_EMAIL_PASSWORD_SEND) {
+ $event->setParsedSubject($this->l->t('Password to access %1$s was send to %2s', [
+ $parsedParameters['file']['path'],
+ $parsedParameters['email']['name']
+ ]))
+ ->setRichSubject($this->l->t('Password to access {file} was send to {email}'), $parsedParameters)
+ ->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg')));
+ } else if ($event->getSubject() === self::SUBJECT_SHARED_EMAIL_PASSWORD_SEND_SELF) {
+ $event->setParsedSubject(
+ $this->l->t('Password to access %1$s was send to you',
+ [$parsedParameters['file']['path']]))
+ ->setRichSubject($this->l->t('Password to access {file} was send to you'), $parsedParameters)
+ ->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg')));
+
} else {
throw new \InvalidArgumentException();
}
@@ -182,6 +209,15 @@ class Activity implements IProvider {
'email' => $this->generateEmailParameter($parameters[1]),
'actor' => $this->generateUserParameter($parameters[2]),
];
+ case self::SUBJECT_SHARED_EMAIL_PASSWORD_SEND:
+ return [
+ 'file' => $this->generateFileParameter((int) $event->getObjectId(), $parameters[0]),
+ 'email' => $this->generateEmailParameter($parameters[1]),
+ ];
+ case self::SUBJECT_SHARED_EMAIL_PASSWORD_SEND_SELF:
+ return [
+ 'file' => $this->generateFileParameter((int) $event->getObjectId(), $parameters[0]),
+ ];
}
throw new \InvalidArgumentException();
}