diff options
author | Julien Veyssier <julien-nc@posteo.net> | 2023-01-26 12:50:00 +0100 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2023-01-27 11:10:56 +0100 |
commit | 8766e4f2429954408e8a7424430e677a69228f8a (patch) | |
tree | 2034c5c707a84c1fa3f033772ea84762c6b561a2 | |
parent | 48f34736cd0ea629a1102b66cc4a67adc2e11321 (diff) | |
download | nextcloud-server-8766e4f2429954408e8a7424430e677a69228f8a.tar.gz nextcloud-server-8766e4f2429954408e8a7424430e677a69228f8a.zip |
handle and return touchProvider errors
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
-rw-r--r-- | core/Controller/ReferenceApiController.php | 10 | ||||
-rw-r--r-- | lib/private/Collaboration/Reference/ReferenceManager.php | 4 | ||||
-rw-r--r-- | lib/public/Collaboration/Reference/IReferenceManager.php | 4 |
3 files changed, 8 insertions, 10 deletions
diff --git a/core/Controller/ReferenceApiController.php b/core/Controller/ReferenceApiController.php index 9c3a212e8d7..6aba56d7e77 100644 --- a/core/Controller/ReferenceApiController.php +++ b/core/Controller/ReferenceApiController.php @@ -97,8 +97,6 @@ class ReferenceApiController extends \OCP\AppFramework\OCSController { /** * @NoAdminRequired - * - * @return DataResponse */ public function getProvidersInfo(): DataResponse { $providers = $this->referenceManager->getDiscoverableProviders(); @@ -110,14 +108,12 @@ class ReferenceApiController extends \OCP\AppFramework\OCSController { /** * @NoAdminRequired - * - * @param string $providerId - * @return DataResponse */ public function touchProvider(string $providerId, ?int $timestamp = null): DataResponse { if ($this->userId !== null) { - $this->referenceManager->touchProvider($this->userId, $providerId, $timestamp); + $success = $this->referenceManager->touchProvider($this->userId, $providerId, $timestamp); + return new DataResponse(['success' => $success]); } - return new DataResponse(['success' => true]); + return new DataResponse(['success' => false]); } } diff --git a/lib/private/Collaboration/Reference/ReferenceManager.php b/lib/private/Collaboration/Reference/ReferenceManager.php index 381f3aea8f4..5db30a50ea6 100644 --- a/lib/private/Collaboration/Reference/ReferenceManager.php +++ b/lib/private/Collaboration/Reference/ReferenceManager.php @@ -242,7 +242,7 @@ class ReferenceManager implements IReferenceManager { /** * @inheritDoc */ - public function touchProvider(string $userId, string $providerId, ?int $timestamp = null): void { + public function touchProvider(string $userId, string $providerId, ?int $timestamp = null): bool { $providers = $this->getDiscoverableProviders(); $providerIds = array_map(static function (IDiscoverableReferenceProvider $provider) { return $provider->getId(); @@ -254,7 +254,9 @@ class ReferenceManager implements IReferenceManager { } $this->config->setUserValue($userId, 'references', $configKey, (string) $timestamp); + return true; } + return false; } /** diff --git a/lib/public/Collaboration/Reference/IReferenceManager.php b/lib/public/Collaboration/Reference/IReferenceManager.php index 8e6dee4aa2d..d757d35834a 100644 --- a/lib/public/Collaboration/Reference/IReferenceManager.php +++ b/lib/public/Collaboration/Reference/IReferenceManager.php @@ -83,10 +83,10 @@ interface IReferenceManager { * @param string $userId * @param string $providerId * @param int|null $timestamp use current timestamp if null - * @return void + * @return bool * @since 26.0.0 */ - public function touchProvider(string $userId, string $providerId, ?int $timestamp = null): void; + public function touchProvider(string $userId, string $providerId, ?int $timestamp = null): bool; /** * Get all known last used timestamps for reference providers |