Merge 70c7173020
into 46dbc8fa98
This commit is contained in:
commit
caec9a2bbb
|
@ -44,9 +44,11 @@ interface INotificationProvider {
|
||||||
* @param VEvent $vevent
|
* @param VEvent $vevent
|
||||||
* @param string $calendarDisplayName
|
* @param string $calendarDisplayName
|
||||||
* @param IUser[] $users
|
* @param IUser[] $users
|
||||||
|
* @param IUser $reminderOwner
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function send(VEvent $vevent,
|
public function send(VEvent $vevent,
|
||||||
string $calendarDisplayName,
|
string $calendarDisplayName,
|
||||||
array $users = []): void;
|
array $users = [],
|
||||||
|
IUser $reminderOwner = null): void;
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,11 +91,13 @@ abstract class AbstractProvider implements INotificationProvider {
|
||||||
* @param VEvent $vevent
|
* @param VEvent $vevent
|
||||||
* @param string $calendarDisplayName
|
* @param string $calendarDisplayName
|
||||||
* @param IUser[] $users
|
* @param IUser[] $users
|
||||||
|
* @param IUser $reminderOwner
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
abstract public function send(VEvent $vevent,
|
abstract public function send(VEvent $vevent,
|
||||||
string $calendarDisplayName,
|
string $calendarDisplayName,
|
||||||
array $users = []): void;
|
array $users = [],
|
||||||
|
IUser $reminderOwner = null): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
|
|
|
@ -37,6 +37,7 @@ use OCP\IConfig;
|
||||||
use OCP\IL10N;
|
use OCP\IL10N;
|
||||||
use OCP\ILogger;
|
use OCP\ILogger;
|
||||||
use OCP\IURLGenerator;
|
use OCP\IURLGenerator;
|
||||||
|
use OCP\IUser;
|
||||||
use OCP\L10N\IFactory as L10NFactory;
|
use OCP\L10N\IFactory as L10NFactory;
|
||||||
use OCP\Mail\IEMailTemplate;
|
use OCP\Mail\IEMailTemplate;
|
||||||
use OCP\Mail\IMailer;
|
use OCP\Mail\IMailer;
|
||||||
|
@ -80,15 +81,24 @@ class EmailProvider extends AbstractProvider {
|
||||||
* @param VEvent $vevent
|
* @param VEvent $vevent
|
||||||
* @param string $calendarDisplayName
|
* @param string $calendarDisplayName
|
||||||
* @param array $users
|
* @param array $users
|
||||||
|
* @param IUser $reminderOwner
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
public function send(VEvent $vevent,
|
public function send(VEvent $vevent,
|
||||||
string $calendarDisplayName,
|
string $calendarDisplayName,
|
||||||
array $users = []):void {
|
array $users = [],
|
||||||
|
IUser $reminderOwner = null):void {
|
||||||
$fallbackLanguage = $this->getFallbackLanguage();
|
$fallbackLanguage = $this->getFallbackLanguage();
|
||||||
|
|
||||||
$emailAddressesOfSharees = $this->getEMailAddressesOfAllUsersWithWriteAccessToCalendar($users);
|
$emailAddressesOfSharees = $this->getEMailAddressesOfAllUsersWithWriteAccessToCalendar($users);
|
||||||
|
|
||||||
|
$organizer = $this->getOrganizerEMailAndNameFromEvent($vevent);
|
||||||
|
|
||||||
|
$emailAddressesOfAttendees = [];
|
||||||
|
|
||||||
|
if ($organizer !== null && $reminderOwner instanceof IUser && strcasecmp($reminderOwner->getEMailAddress(), key($organizer)) === 0) {
|
||||||
$emailAddressesOfAttendees = $this->getAllEMailAddressesFromEvent($vevent);
|
$emailAddressesOfAttendees = $this->getAllEMailAddressesFromEvent($vevent);
|
||||||
|
}
|
||||||
|
|
||||||
// Quote from php.net:
|
// Quote from php.net:
|
||||||
// If the input arrays have the same string keys, then the later value for that key will overwrite the previous one.
|
// If the input arrays have the same string keys, then the later value for that key will overwrite the previous one.
|
||||||
|
@ -99,7 +109,6 @@ class EmailProvider extends AbstractProvider {
|
||||||
);
|
);
|
||||||
|
|
||||||
$sortedByLanguage = $this->sortEMailAddressesByLanguage($emailAddresses, $fallbackLanguage);
|
$sortedByLanguage = $this->sortEMailAddressesByLanguage($emailAddresses, $fallbackLanguage);
|
||||||
$organizer = $this->getOrganizerEMailAndNameFromEvent($vevent);
|
|
||||||
|
|
||||||
foreach ($sortedByLanguage as $lang => $emailAddresses) {
|
foreach ($sortedByLanguage as $lang => $emailAddresses) {
|
||||||
if (!$this->hasL10NForLang($lang)) {
|
if (!$this->hasL10NForLang($lang)) {
|
||||||
|
|
|
@ -83,11 +83,13 @@ class PushProvider extends AbstractProvider {
|
||||||
* @param VEvent $vevent
|
* @param VEvent $vevent
|
||||||
* @param string $calendarDisplayName
|
* @param string $calendarDisplayName
|
||||||
* @param IUser[] $users
|
* @param IUser[] $users
|
||||||
|
* @param IUser $reminderOwner
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
public function send(VEvent $vevent,
|
public function send(VEvent $vevent,
|
||||||
string $calendarDisplayName = null,
|
string $calendarDisplayName = null,
|
||||||
array $users = []):void {
|
array $users = [],
|
||||||
|
IUser $reminderOwner = null):void {
|
||||||
if ($this->config->getAppValue('dav', 'sendEventRemindersPush', 'no') !== 'yes') {
|
if ($this->config->getAppValue('dav', 'sendEventRemindersPush', 'no') !== 'yes') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -142,13 +142,13 @@ class ReminderService {
|
||||||
}
|
}
|
||||||
|
|
||||||
$users = $this->getAllUsersWithWriteAccessToCalendar($reminder['calendar_id']);
|
$users = $this->getAllUsersWithWriteAccessToCalendar($reminder['calendar_id']);
|
||||||
$user = $this->getUserFromPrincipalURI($reminder['principaluri']);
|
$userOfReminder = $this->getUserFromPrincipalURI($reminder['principaluri']);
|
||||||
if ($user) {
|
if ($userOfReminder) {
|
||||||
$users[] = $user;
|
$users[] = $userOfReminder;
|
||||||
}
|
}
|
||||||
|
|
||||||
$notificationProvider = $this->notificationProviderManager->getProvider($reminder['type']);
|
$notificationProvider = $this->notificationProviderManager->getProvider($reminder['type']);
|
||||||
$notificationProvider->send($vevent, $reminder['displayname'], $users);
|
$notificationProvider->send($vevent, $reminder['displayname'], $users, $userOfReminder);
|
||||||
|
|
||||||
$this->deleteOrProcessNext($reminder, $vevent);
|
$this->deleteOrProcessNext($reminder, $vevent);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue