|
11 | 11 | use OC\URLGenerator; |
12 | 12 | use OCA\DAV\CalDAV\EventReader; |
13 | 13 | use OCP\AppFramework\Utility\ITimeFactory; |
14 | | -use OCP\IConfig; |
| 14 | +use OCP\Config\IUserConfig; |
| 15 | +use OCP\IAppConfig; |
15 | 16 | use OCP\IDBConnection; |
16 | 17 | use OCP\IL10N; |
17 | 18 | use OCP\IUserManager; |
@@ -40,12 +41,13 @@ class IMipService { |
40 | 41 |
|
41 | 42 | public function __construct( |
42 | 43 | private URLGenerator $urlGenerator, |
43 | | - private IConfig $config, |
44 | 44 | private IDBConnection $db, |
45 | 45 | private ISecureRandom $random, |
46 | 46 | private L10NFactory $l10nFactory, |
47 | 47 | private ITimeFactory $timeFactory, |
48 | 48 | private readonly IUserManager $userManager, |
| 49 | + private readonly IUserConfig $userConfig, |
| 50 | + private readonly IAppConfig $appConfig, |
49 | 51 | ) { |
50 | 52 | $language = $this->l10nFactory->findGenericLanguage(); |
51 | 53 | $locale = $this->l10nFactory->findLocale($language); |
@@ -885,8 +887,8 @@ public function setL10nFromAttendee(Property $attendee) { |
885 | 887 | $users = $this->userManager->getByEmail($userAddress); |
886 | 888 | if ($users !== []) { |
887 | 889 | $user = array_shift($users); |
888 | | - $language = $this->config->getUserValue($user->getUID(), 'core', 'lang', null); |
889 | | - $locale = $this->config->getUserValue($user->getUID(), 'core', 'locale', null); |
| 890 | + $language = $this->userConfig->getValueString($user->getUID(), 'core', 'lang', '') ?: null; |
| 891 | + $locale = $this->userConfig->getValueString($user->getUID(), 'core', 'locale', '') ?: null; |
890 | 892 | } |
891 | 893 | // fallback to attendee LANGUAGE parameter if language not set |
892 | 894 | if ($language === null && isset($attendee['LANGUAGE']) && $attendee['LANGUAGE'] instanceof Parameter) { |
@@ -994,20 +996,20 @@ public function getAbsoluteImagePath($path): string { |
994 | 996 | * The default is 'no', which matches old behavior, and is privacy preserving. |
995 | 997 | * |
996 | 998 | * To enable including attendees in invitation emails: |
997 | | - * % php occ config:app:set dav invitation_list_attendees --value yes |
| 999 | + * % php occ config:app:set dav invitation_list_attendees --value yes --type bool |
998 | 1000 | * |
999 | 1001 | * @param IEMailTemplate $template |
1000 | 1002 | * @param IL10N $this->l10n |
1001 | 1003 | * @param VEvent $vevent |
1002 | 1004 | * @author brad2014 on github.com |
1003 | 1005 | */ |
1004 | 1006 | public function addAttendees(IEMailTemplate $template, VEvent $vevent) { |
1005 | | - if ($this->config->getAppValue('dav', 'invitation_list_attendees', 'no') === 'no') { |
| 1007 | + if (!$this->appConfig->getValueBool('dav', 'invitation_list_attendees')) { |
1006 | 1008 | return; |
1007 | 1009 | } |
1008 | 1010 |
|
1009 | 1011 | if (isset($vevent->ORGANIZER)) { |
1010 | | - /** @var Property | Property\ICalendar\CalAddress $organizer */ |
| 1012 | + /** @var Property&Property\ICalendar\CalAddress $organizer */ |
1011 | 1013 | $organizer = $vevent->ORGANIZER; |
1012 | 1014 | $organizerEmail = substr($organizer->getNormalizedValue(), 7); |
1013 | 1015 | /** @var string|null $organizerName */ |
@@ -1037,8 +1039,14 @@ public function addAttendees(IEMailTemplate $template, VEvent $vevent) { |
1037 | 1039 | $attendeesHTML = []; |
1038 | 1040 | $attendeesText = []; |
1039 | 1041 | foreach ($attendees as $attendee) { |
| 1042 | + /** @var Property&Property\ICalendar\CalAddress $attendee */ |
1040 | 1043 | $attendeeEmail = substr($attendee->getNormalizedValue(), 7); |
1041 | | - $attendeeName = isset($attendee['CN']) ? $attendee['CN']->getValue() : null; |
| 1044 | + $attendeeName = null; |
| 1045 | + if (isset($attendee['CN'])) { |
| 1046 | + /** @var Parameter $cn */ |
| 1047 | + $cn = $attendee['CN']; |
| 1048 | + $attendeeName = $cn->getValue(); |
| 1049 | + } |
1042 | 1050 | $attendeeHTML = sprintf('<a href="%s">%s</a>', |
1043 | 1051 | htmlspecialchars($attendee->getNormalizedValue()), |
1044 | 1052 | htmlspecialchars($attendeeName ?: $attendeeEmail)); |
|
0 commit comments