Skip to content

Commit c4672f0

Browse files
authored
Merge pull request #2334 from nextcloud/bugfixes
2 parents 4c2346c + 6a409c5 commit c4672f0

File tree

7 files changed

+36
-22
lines changed

7 files changed

+36
-22
lines changed

lib/DAV/DeckCalendarBackend.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function __construct(
5959
}
6060

6161
public function getBoards(): array {
62-
return $this->boardService->findAll();
62+
return $this->boardService->findAll(-1, null, false);
6363
}
6464

6565
public function getBoard(int $id): Board {

lib/Db/BoardMapper.php

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,18 @@ public function find($id, $withLabels = false, $withAcl = false) {
9393
* @param null $offset
9494
* @return array
9595
*/
96-
public function findAllByUser($userId, $limit = null, $offset = null, $since = -1) {
97-
$sql = 'SELECT id, title, owner, color, archived, deleted_at, 0 as shared, last_modified FROM `*PREFIX*deck_boards` WHERE owner = ? AND last_modified > ? UNION ' .
96+
public function findAllByUser($userId, $limit = null, $offset = null, $since = -1, $includeArchived = true) {
97+
// FIXME: One moving to QBMapper we should allow filtering the boards probably by method chaining for additional where clauses
98+
$sql = 'SELECT id, title, owner, color, archived, deleted_at, 0 as shared, last_modified FROM `*PREFIX*deck_boards` WHERE owner = ? AND last_modified > ?';
99+
if (!$includeArchived) {
100+
$sql .= ' AND NOT archived';
101+
}
102+
$sql .= ' UNION ' .
98103
'SELECT boards.id, title, owner, color, archived, deleted_at, 1 as shared, last_modified FROM `*PREFIX*deck_boards` as boards ' .
99104
'JOIN `*PREFIX*deck_board_acl` as acl ON boards.id=acl.board_id WHERE acl.participant=? AND acl.type=? AND boards.owner != ? AND last_modified > ?';
105+
if (!$includeArchived) {
106+
$sql .= ' AND NOT archived';
107+
}
100108
$entries = $this->findEntities($sql, [$userId, $since, $userId, Acl::PERMISSION_TYPE_USER, $userId, $since], $limit, $offset);
101109
/* @var Board $entry */
102110
foreach ($entries as $entry) {
@@ -120,7 +128,7 @@ public function findAllByOwner(string $userId, int $limit = null, int $offset =
120128
* @param null $offset
121129
* @return array
122130
*/
123-
public function findAllByGroups($userId, $groups, $limit = null, $offset = null) {
131+
public function findAllByGroups($userId, $groups, $limit = null, $offset = null, $since = -1,$includeArchived = true) {
124132
if (count($groups) <= 0) {
125133
return [];
126134
}
@@ -132,7 +140,10 @@ public function findAllByGroups($userId, $groups, $limit = null, $offset = null)
132140
$sql .= ' OR ';
133141
}
134142
}
135-
$sql .= ');';
143+
$sql .= ')';
144+
if (!$includeArchived) {
145+
$sql .= ' AND NOT archived';
146+
}
136147
$entries = $this->findEntities($sql, array_merge([$userId, Acl::PERMISSION_TYPE_GROUP], $groups), $limit, $offset);
137148
/* @var Board $entry */
138149
foreach ($entries as $entry) {
@@ -142,7 +153,7 @@ public function findAllByGroups($userId, $groups, $limit = null, $offset = null)
142153
return $entries;
143154
}
144155

145-
public function findAllByCircles($userId, $limit = null, $offset = null) {
156+
public function findAllByCircles($userId, $limit = null, $offset = null, $since = -1,$includeArchived = true) {
146157
if (!$this->circlesEnabled) {
147158
return [];
148159
}
@@ -161,7 +172,10 @@ public function findAllByCircles($userId, $limit = null, $offset = null) {
161172
$sql .= ' OR ';
162173
}
163174
}
164-
$sql .= ');';
175+
$sql .= ')';
176+
if (!$includeArchived) {
177+
$sql .= ' AND NOT archived';
178+
}
165179
$entries = $this->findEntities($sql, array_merge([$userId, Acl::PERMISSION_TYPE_CIRCLE], $circles), $limit, $offset);
166180
/* @var Board $entry */
167181
foreach ($entries as $entry) {

lib/Service/BoardService.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,11 @@ public function setUserId(string $userId): void {
107107
$this->userId = $userId;
108108
}
109109

110-
public function getUserBoards(int $since = -1): array {
110+
public function getUserBoards(int $since = -1, $includeArchived = true): array {
111111
$userInfo = $this->getBoardPrerequisites();
112-
$userBoards = $this->boardMapper->findAllByUser($userInfo['user'], null, null, $since);
113-
$groupBoards = $this->boardMapper->findAllByGroups($userInfo['user'], $userInfo['groups'],null, null, $since);
114-
$circleBoards = $this->boardMapper->findAllByCircles($userInfo['user'], null, null, $since);
112+
$userBoards = $this->boardMapper->findAllByUser($userInfo['user'], null, null, $since, $includeArchived);
113+
$groupBoards = $this->boardMapper->findAllByGroups($userInfo['user'], $userInfo['groups'],null, null, $since, $includeArchived);
114+
$circleBoards = $this->boardMapper->findAllByCircles($userInfo['user'], null, null, $since, $includeArchived);
115115
$mergedBoards = array_merge($userBoards, $groupBoards, $circleBoards);
116116
$result = [];
117117
/** @var Board $item */
@@ -125,11 +125,11 @@ public function getUserBoards(int $since = -1): array {
125125
/**
126126
* @return array
127127
*/
128-
public function findAll($since = -1, $details = null) {
128+
public function findAll($since = -1, $details = null, $includeArchived = true) {
129129
if ($this->boardsCache) {
130130
return $this->boardsCache;
131131
}
132-
$complete = $this->getUserBoards($since);
132+
$complete = $this->getUserBoards($since, $includeArchived);
133133
$result = [];
134134
/** @var Board $item */
135135
foreach ($complete as &$item) {

package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"@nextcloud/l10n": "^1.4.1",
4141
"@nextcloud/moment": "^1.1.1",
4242
"@nextcloud/router": "^1.2.0",
43-
"@nextcloud/vue": "^2.6.5",
43+
"@nextcloud/vue": "^2.6.8",
4444
"@nextcloud/vue-dashboard": "^1.0.1",
4545
"blueimp-md5": "^2.18.0",
4646
"dompurify": "^2.1.1",

src/components/board/SharingTabSidebar.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ export default {
119119
120120
sharee.value = item.value
121121
return sharee
122-
})
122+
}).slice(0, 10)
123123
},
124124
unallocatedSharees() {
125125
return this.sharees.filter((sharee) => {

src/components/cards/CardItem.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ export default {
118118
return this.$store.getters.canEdit
119119
}
120120
const board = this.$store.getters.boards.find((item) => item.id === this.card.boardId)
121-
return board.permissions.PERMISSION_EDIT
121+
return board ? board.permissions.PERMISSION_EDIT : false
122122
},
123123
card() {
124124
return this.item ? this.item : this.$store.getters.cardById(this.id)

0 commit comments

Comments
 (0)