-
-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(caldav): Do not load IMipPlugin before user auth and session is c… #45098
Changes from 2 commits
9859a44
f44b73e
d25039e
2088b49
51d338b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,7 +41,7 @@ | |
use OCP\AppFramework\Utility\ITimeFactory; | ||
use OCP\Defaults; | ||
use OCP\IConfig; | ||
use OCP\IUserManager; | ||
use OCP\IUserSession; | ||
use OCP\Mail\IMailer; | ||
use OCP\Util; | ||
use Psr\Log\LoggerInterface; | ||
|
@@ -69,13 +69,12 @@ | |
* @license http://sabre.io/license/ Modified BSD License | ||
*/ | ||
class IMipPlugin extends SabreIMipPlugin { | ||
private ?string $userId; | ||
private IUserSession $userSession; | ||
private IConfig $config; | ||
private IMailer $mailer; | ||
private LoggerInterface $logger; | ||
private ITimeFactory $timeFactory; | ||
private Defaults $defaults; | ||
private IUserManager $userManager; | ||
private ?VCalendar $vCalendar = null; | ||
private IMipService $imipService; | ||
public const MAX_DATE = '2038-01-01'; | ||
|
@@ -90,18 +89,16 @@ | |
LoggerInterface $logger, | ||
ITimeFactory $timeFactory, | ||
Defaults $defaults, | ||
IUserManager $userManager, | ||
$userId, | ||
IUserSession $userSession, | ||
IMipService $imipService, | ||
EventComparisonService $eventComparisonService) { | ||
parent::__construct(''); | ||
$this->userId = $userId; | ||
$this->userSession = $userSession; | ||
$this->config = $config; | ||
$this->mailer = $mailer; | ||
$this->logger = $logger; | ||
$this->timeFactory = $timeFactory; | ||
$this->defaults = $defaults; | ||
$this->userManager = $userManager; | ||
$this->imipService = $imipService; | ||
$this->eventComparisonService = $eventComparisonService; | ||
} | ||
|
@@ -206,17 +203,16 @@ | |
$this->imipService->setL10n($attendee); | ||
|
||
// Build the sender name. | ||
// Due to a bug in sabre, the senderName property for an iTIP message | ||
// can actually also be a VObject Property | ||
/** @var Parameter|string|null $senderName */ | ||
$senderName = $iTipMessage->senderName ?: null; | ||
if($senderName instanceof Parameter) { | ||
$senderName = $senderName->getValue() ?? null; | ||
// Due to a bug in sabre, the senderName property for an iTIP message can actually also be a VObject Property | ||
// If the iTIP message senderName is null or empty use the user session name as the senderName | ||
if (($iTipMessage->senderName instanceof Parameter) && !empty(trim($iTipMessage->senderName->getValue()))) { | ||
$senderName = $iTipMessage->senderName->getValue(); | ||
} | ||
|
||
// Try to get the sender name from the current user id if available. | ||
if ($this->userId !== null && ($senderName === null || empty(trim($senderName)))) { | ||
$senderName = $this->userManager->getDisplayName($this->userId); | ||
elseif (is_string($iTipMessage->senderName) && !empty(trim($iTipMessage->senderName))) { | ||
$senderName = $iTipMessage->senderName; | ||
} | ||
else { | ||
$senderName = $this->userSession->getUser()->getDisplayName(); | ||
|
||
} | ||
|
||
$sender = substr($iTipMessage->sender, 7); | ||
|
Check notice
Code scanning / Psalm
PossiblyNullArgument Note