Skip to content

Commit

Permalink
Merge pull request #197 from nextcloud/backport-email-update
Browse files Browse the repository at this point in the history
Backport email update
  • Loading branch information
MorrisJobke committed Sep 5, 2017
2 parents 5456f05 + 2324876 commit 3b55838
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions lib/MailQueueHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -337,11 +337,6 @@ protected function sendEmailToUser($userName, $email, $lang, $timezone, $maxTime
$this->dataHelper->setL10n($l);
$this->activityManager->setCurrentUserId($userName);

$template = $this->mailer->createEMailTemplate();
$template->addHeader();
$template->addHeading($l->t('Hello %s',[$user->getDisplayName()]), $l->t('Hello %s,',[$user->getDisplayName()]));
$template->addBodyText($l->t('There was some activity at %s', [$this->urlGenerator->getAbsoluteURL('/')]));

$activityEvents = [];
foreach ($mailData as $activity) {
$event = $this->activityManager->generateEvent();
Expand Down Expand Up @@ -370,20 +365,29 @@ protected function sendEmailToUser($userName, $email, $lang, $timezone, $maxTime
'event' => $event,
'relativeDateTime' => $relativeDateTime
];

$template->addBodyListItem($event->getParsedSubject(), $relativeDateTime, $event->getIcon());
}

if ($skippedCount) {
$template->addBodyListItem($l->n('and %n more ', 'and %n more ', $skippedCount));
}

$template->setMetaData('activity.Notification', [
$template = $this->mailer->createEMailTemplate('activity.Notification', [
'displayname' => $user->getDisplayName(),
'url' => $this->urlGenerator->getAbsoluteURL('/'),
'activityEvents' => $activityEvents,
'skippedCount' => $skippedCount,
]);
$template->addHeader();
$template->addHeading($l->t('Hello %s',[$user->getDisplayName()]), $l->t('Hello %s,',[$user->getDisplayName()]));
$template->addBodyText($l->t('There was some activity at %s', [$this->urlGenerator->getAbsoluteURL('/')]));

foreach ($activityEvents as $activity) {
/** @var IEvent $event */
$event = $activity['event'];
$relativeDateTime = $activity['relativeDateTime'];

$template->addBodyListItem($event->getParsedSubject(), $relativeDateTime, $event->getIcon());
}

if ($skippedCount) {
$template->addBodyListItem($l->n('and %n more ', 'and %n more ', $skippedCount));
}

$template->addFooter();

Expand Down

0 comments on commit 3b55838

Please sign in to comment.