Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/text.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2020-12-17 17:30:34 +0300
committerGitHub <noreply@github.com>2020-12-17 17:30:34 +0300
commit5b9d41ed10ac41cf587ea562a94519f9c173be03 (patch)
tree60685c6b54a784f4127cce066ac67b80dacbb916
parenta69bac7d3845cf565daf3f796367d8eafed05b78 (diff)
parentb4963f71349ba3a913b12862f04a281f5ed870bf (diff)
Merge pull request #1015 from nextcloud/fix/use_correct_cachev21.0.0beta2
Use to correct cache to obtain version info
-rw-r--r--lib/Service/ApiService.php8
-rw-r--r--lib/Service/DocumentService.php6
2 files changed, 6 insertions, 8 deletions
diff --git a/lib/Service/ApiService.php b/lib/Service/ApiService.php
index bae813649..f93ba1171 100644
--- a/lib/Service/ApiService.php
+++ b/lib/Service/ApiService.php
@@ -46,14 +46,13 @@ use OCP\Lock\LockedException;
class ApiService {
- protected $cache;
+ protected $request;
protected $sessionService;
protected $documentService;
protected $logger;
- public function __construct(IRequest $request, ICacheFactory $cacheFactory, SessionService $sessionService, DocumentService $documentService, ILogger $logger) {
+ public function __construct(IRequest $request, SessionService $sessionService, DocumentService $documentService, ILogger $logger) {
$this->request = $request;
- $this->cache = $cacheFactory->createDistributed('textSession');
$this->sessionService = $sessionService;
$this->documentService = $documentService;
$this->logger = $logger;
@@ -158,9 +157,6 @@ class ApiService {
if (!$this->sessionService->isValidSession($documentId, $sessionId, $sessionToken)) {
return new DataResponse([], 403);
}
- if ($version === $this->cache->get('document-version-' . $documentId)) {
- return new DataResponse(['steps' => []]);
- }
try {
$result = [
diff --git a/lib/Service/DocumentService.php b/lib/Service/DocumentService.php
index 918fe31df..74cd2e0a3 100644
--- a/lib/Service/DocumentService.php
+++ b/lib/Service/DocumentService.php
@@ -253,9 +253,11 @@ class DocumentService {
}
}
- public function getSteps($documentId, $lastVersion) {
+ public function getSteps($documentId, $lastVersion): array {
+ if ($lastVersion === $this->cache->get('document-version-' . $documentId)) {
+ return [];
+ }
$steps = $this->stepMapper->find($documentId, $lastVersion);
- //return $steps;
$unique_array = [];
foreach($steps as $step) {
$version = $step->getVersion();