* @copyright Copyright (c) 2016, ownCloud, Inc.
* @copyright Copyright (c) 2017, Georg Ehrke
*
- * @author brad2014 <brad2014@users.noreply.github.com>
* @author Brad Rubenstein <brad@wbr.tech>
* @author Christoph Wurst <christoph@winzerhof-wurst.at>
* @author Georg Ehrke <oc.list@georgehrke.com>
$summary = ((string) $summary !== '') ? (string) $summary : $l10n->t('Untitled event');
- $this->addSubjectAndHeading($template, $l10n, $method, $summary,
- $meetingAttendeeName, $meetingInviteeName);
+ $this->addSubjectAndHeading($template, $l10n, $method, $summary);
$this->addBulletList($template, $l10n, $vevent);
* @param VEvent $vevent
*/
private function generateWhenString(IL10N $l10n, VEvent $vevent) {
-
$dtstart = $vevent->DTSTART;
if (isset($vevent->DTEND)) {
$dtend = $vevent->DTEND;
} elseif (isset($vevent->DURATION)) {
$isFloating = $vevent->DTSTART->isFloating();
$dtend = clone $vevent->DTSTART;
- $endDateTime = $end->getDateTime();
+ $endDateTime = $dtend->getDateTime();
$endDateTime = $endDateTime->add(DateTimeParser::parse($vevent->DURATION->getValue()));
$dtend->setDateTime($endDateTime, $isFloating);
} elseif (!$vevent->DTSTART->hasTime()) {
$isFloating = $vevent->DTSTART->isFloating();
$dtend = clone $vevent->DTSTART;
- $endDateTime = $end->getDateTime();
+ $endDateTime = $dtend->getDateTime();
$endDateTime = $endDateTime->modify('+1 day');
$dtend->setDateTime($endDateTime, $isFloating);
} else {
* @param VEVENT $vevent
*/
private function addBulletList(IEMailTemplate $template, IL10N $l10n, $vevent) {
-
if ($vevent->SUMMARY) {
$template->addBodyListItem($vevent->SUMMARY, $l10n->t('Title:'),
$this->getAbsoluteImagePath('caldav/title.svg'),'','',self::IMIP_INDENT);
$this->getAbsoluteImagePath('caldav/location.svg'),'','',self::IMIP_INDENT);
}
if ($vevent->URL) {
+ $url = $vevent->URL->getValue();
$template->addBodyListItem(sprintf('<a href="%s">%s</a>',
- htmlspecialchars($vevent->URL),
- htmlspecialchars($vevent->URL)),
+ htmlspecialchars($url),
+ htmlspecialchars($url)),
$l10n->t('Link:'),
$this->getAbsoluteImagePath('caldav/link.svg'),
- $vevent->URL,'',self::IMIP_INDENT);
+ $url,'',self::IMIP_INDENT);
}
$this->addAttendees($template, $l10n, $vevent);
/* Put description last, like an email body, since it can be arbitrarily long */
if ($vevent->DESCRIPTION) {
- $template->addBodyListItem($vevent->DESCRIPTION, $l10n->t('Description:'),
+ $template->addBodyListItem($vevent->DESCRIPTION->getValue(), $l10n->t('Description:'),
$this->getAbsoluteImagePath('caldav/description.svg'),'','',self::IMIP_INDENT);
}
}
}
if (isset($vevent->ORGANIZER)) {
+ /** @var Property\ICalendar\CalAddress $organizer */
$organizer = $vevent->ORGANIZER;
$organizerURI = $organizer->getNormalizedValue();
list($scheme,$organizerEmail) = explode(':',$organizerURI,2); # strip off scheme mailto:
+ /** @var string|null $organizerName */
$organizerName = isset($organizer['CN']) ? $organizer['CN'] : null;
$organizerHTML = sprintf('<a href="%s">%s</a>',
htmlspecialchars($organizerURI),
htmlspecialchars($organizerName ?: $organizerEmail));
$organizerText = sprintf('%s <%s>', $organizerName, $organizerEmail);
- if (isset($organizer['PARTSTAT'])
- && strcasecmp($organizer['PARTSTAT'], 'ACCEPTED') === 0) {
- $organizerHTML .= ' ✔︎';
- $organizerText .= ' ✔︎';
+ if (isset($organizer['PARTSTAT'])) {
+ /** @var Parameter $partstat */
+ $partstat = $organizer['PARTSTAT'];
+ if (strcasecmp($partstat->getValue(), 'ACCEPTED') === 0) {
+ $organizerHTML .= ' ✔︎';
+ $organizerText .= ' ✔︎';
+ }
}
$template->addBodyListItem($organizerHTML, $l10n->t('Organizer:'),
$this->getAbsoluteImagePath('caldav/organizer.svg'),
public function testDelivery() {
$this->config
+ ->expects($this->at(1))
->method('getAppValue')
->with('dav', 'invitation_link_recipients', 'yes')
->willReturn('yes');
public function testFailedDelivery() {
$this->config
+ ->expects($this->at(1))
->method('getAppValue')
->with('dav', 'invitation_link_recipients', 'yes')
->willReturn('yes');
public function testDeliveryWithNoCommonName() {
$this->config
+ ->expects($this->at(1))
->method('getAppValue')
->with('dav', 'invitation_link_recipients', 'yes')
->willReturn('yes');
*/
public function testNoMessageSendForPastEvents(array $veventParams, bool $expectsMail) {
$this->config
- ->method('getAppValue')
- ->with('dav', 'invitation_link_recipients', 'yes')
- ->willReturn('yes');
+ ->method('getAppValue')
+ ->willReturn('yes');
$message = $this->_testMessage($veventParams);
$this->_expectSend($recipient, true, $has_buttons);
$this->config
+ ->expects($this->at(1))
->method('getAppValue')
->with('dav', 'invitation_link_recipients', 'yes')
->willReturn($config_setting);
public function testMessageSendWhenEventWithoutName() {
$this->config
->method('getAppValue')
- ->with('dav', 'invitation_link_recipients', 'yes')
->willReturn('yes');
$message = $this->_testMessage(['SUMMARY' => '']);
$this->_expectSend('frodo@hobb.it', true, true,'Invitation: Untitled event');
$this->emailTemplate->expects($this->once())
->method('addHeading')
- ->with('Mr. Wizard invited you to »Untitled event«');
+ ->with('Invitation');
$this->plugin->schedule($message);
$this->assertEquals('1.1', $message->getScheduleStatus());
}
* @param string $metaInfo Note: When $plainMetaInfo falls back to this, HTML is automatically escaped in the HTML email
* @param string $icon Absolute path, must be 16*16 pixels
* @param string|bool $plainText Text that is used in the plain text email
- * if empty the $text is used, if false none will be used
+ * if empty or true the $text is used, if false none will be used
* @param string|bool $plainMetaInfo Meta info that is used in the plain text email
- * if empty the $metaInfo is used, if false none will be used
+ * if empty or true the $metaInfo is used, if false none will be used
* @param integer plainIndent If > 0, Indent plainText by this amount.
* @since 12.0.0
*/
public function addBodyListItem(string $text, string $metaInfo = '', string $icon = '', $plainText = '', $plainMetaInfo = '', $plainIndent = 0) {
$this->ensureBodyListOpened();
- if ($plainText === '') {
+ if ($plainText === '' || $plainText === true) {
$plainText = $text;
$text = htmlspecialchars($text);
$text = str_replace("\n", "<br/>", $text); // convert newlines to HTML breaks
}
- if ($plainMetaInfo === '') {
+ if ($plainMetaInfo === '' || $plainMetaInfo === true) {
$plainMetaInfo = $metaInfo;
$metaInfo = htmlspecialchars($metaInfo);
}
* "plainIndent". Multilines after the first are indented plainIndent+1
* (to account for space after label). Fixes: #12391
*/
+ /** @var string $label */
+ $label = ($plainMetaInfo !== false)? $plainMetaInfo : '';
$this->plainBody .= sprintf("%${plainIndent}s %s\n",
- $plainMetaInfo,
+ $label,
str_replace("\n", "\n" . str_repeat(' ', $plainIndent+1), $plainText));
}
}