1
0
Fork 0

Fix getUser (#5)

This commit is contained in:
Ricki Hirner 2024-07-01 22:22:41 +02:00 committed by GitHub
parent b0335735fe
commit 6af07f6f8d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -60,8 +60,7 @@ class SubscriptionManagementPlugin extends ServerPlugin {
private IUserSession $userSession, private IUserSession $userSession,
private TransportManager $transportManager, private TransportManager $transportManager,
private IURLGenerator $URLGenerator, private IURLGenerator $URLGenerator,
private SubscriptionService $subscriptionService, private SubscriptionService $subscriptionService
private $userId,
) { ) {
} }
@ -150,7 +149,8 @@ class SubscriptionManagementPlugin extends ServerPlugin {
$response->setStatus($responseStatus); $response->setStatus($responseStatus);
// create subscription entry in db // create subscription entry in db
$subscription = $this->subscriptionService->create($this->userId, $node->getName(), $subscriptionType, $subscriptionExpires, $data); $user = $this->userSession->getUser();
$subscription = $this->subscriptionService->create($user->getUID(), $node->getName(), $subscriptionType, $subscriptionExpires, $data);
// generate default unsubscribe link, unless transport requested a custom url // generate default unsubscribe link, unless transport requested a custom url
$unsubscribeLink = $unsubscribeLink ?? $this->URLGenerator->getAbsoluteURL("/apps/dav_push/subscriptions/" . $subscription->getId()); $unsubscribeLink = $unsubscribeLink ?? $this->URLGenerator->getAbsoluteURL("/apps/dav_push/subscriptions/" . $subscription->getId());