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
path: root/lib
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2020-01-24 19:04:01 +0300
committerJulius Härtl <jus@bitgrid.net>2020-02-04 21:13:50 +0300
commitde537819d51795ff2a8c720030a5c6baee541421 (patch)
tree8c1359ce61b2a24de14e61772cc10c149eb5469d /lib
parent5fa28fc23a94231dc0d5f7c67816c25250ba2826 (diff)
Filter out duplicate version steps
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'lib')
-rw-r--r--lib/Service/DocumentService.php15
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/Service/DocumentService.php b/lib/Service/DocumentService.php
index 9798143e0..ea10ef569 100644
--- a/lib/Service/DocumentService.php
+++ b/lib/Service/DocumentService.php
@@ -228,7 +228,20 @@ class DocumentService {
}
public function getSteps($documentId, $lastVersion) {
- return $this->stepMapper->find($documentId, $lastVersion);
+ $steps = $this->stepMapper->find($documentId, $lastVersion);
+ //return $steps;
+ $unique_array = [];
+ foreach($steps as $step) {
+ $version = $step->getVersion();
+ if (!array_key_exists($version, $unique_array)) {
+ $unique_array[(string)$version] = $step;
+ } else {
+ // found duplicate step
+ // FIXME: verify that this version is the correct one
+ //$this->stepMapper->delete($step);
+ }
+ }
+ return array_values($unique_array);
}
/**