mirror of
https://github.com/nextcloud/server.git
synced 2026-04-21 06:08:46 -04:00
handle and return touchProvider errors
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
This commit is contained in:
parent
48f34736cd
commit
8766e4f242
3 changed files with 8 additions and 10 deletions
|
|
@ -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]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue