Skip to content

Commit e26fd70

Browse files
fix(tables): remove double-calling, consolidate db writes and use current year for SPDX header
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
1 parent 5cbb8a3 commit e26fd70

3 files changed

Lines changed: 7 additions & 3 deletions

File tree

lib/Service/RowService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public function findAllByTable(int $tableId, string $userId, ?int $limit = null,
9898
$showColumnIds = array_map(fn (Column $column) => $column->getId(), $tableColumns);
9999

100100
$table = $this->tableMapper->find($tableId);
101-
$sort = !empty($table->getSortArray()) ? $table->getSortArray() : null;
101+
$sort = $table->getSortArray() ?: null;
102102

103103
return $this->row2Mapper->findAll($showColumnIds, $tableId, $limit, $offset, null, $sort, $userId);
104104
} else {

lib/UserMigration/TablesMigrator.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ public function import(
200200

201201
$columnIdMap = $this->importColumns($importSource, $newTable, $table, $columnIdMap);
202202

203+
$needsUpdate = false;
203204
if (!empty($table['columnOrder'])) {
204205
$remapped = array_map(function (array $entry) use ($columnIdMap): array {
205206
if (isset($entry['columnId'])) {
@@ -208,7 +209,7 @@ public function import(
208209
return $entry;
209210
}, $table['columnOrder']);
210211
$newTable->setColumnOrder(json_encode($remapped));
211-
$this->tableMapper->update($newTable);
212+
$needsUpdate = true;
212213
}
213214
if (!empty($table['sort'])) {
214215
$remapped = array_map(function (array $entry) use ($columnIdMap): array {
@@ -218,6 +219,9 @@ public function import(
218219
return $entry;
219220
}, $table['sort']);
220221
$newTable->setSort(json_encode($remapped));
222+
$needsUpdate = true;
223+
}
224+
if ($needsUpdate) {
221225
$this->tableMapper->update($newTable);
222226
}
223227

src/modules/main/partials/editTablePartials/DefaultSortRules.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
- SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
2+
- SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
33
- SPDX-License-Identifier: AGPL-3.0-or-later
44
-->
55
<template>

0 commit comments

Comments
 (0)