Skip to content

Commit 8c1774c

Browse files
authored
Merge pull request #2517 from nextcloud/bugfix/2482
Filter out duplicate cards in overview
2 parents cc871f3 + a7f8c18 commit 8c1774c

3 files changed

Lines changed: 6 additions & 10 deletions

File tree

lib/Db/RelationalEntity.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ public function jsonSerialize() {
8686
return $json;
8787
}
8888

89+
public function __toString(): string {
90+
return (string)$this->getId();
91+
}
92+
8993
/*
9094
* Resolve relational data from external methods
9195
*

lib/Service/BoardService.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -119,15 +119,7 @@ public function getUserBoards(int $since = -1, $includeArchived = true): array {
119119
$userBoards = $this->boardMapper->findAllByUser($userInfo['user'], null, null, $since, $includeArchived);
120120
$groupBoards = $this->boardMapper->findAllByGroups($userInfo['user'], $userInfo['groups'],null, null, $since, $includeArchived);
121121
$circleBoards = $this->boardMapper->findAllByCircles($userInfo['user'], null, null, $since, $includeArchived);
122-
$mergedBoards = array_merge($userBoards, $groupBoards, $circleBoards);
123-
$result = [];
124-
/** @var Board $item */
125-
foreach ($mergedBoards as &$item) {
126-
if (!array_key_exists($item->getId(), $result)) {
127-
$result[$item->getId()] = $item;
128-
}
129-
}
130-
return array_values($result);
122+
return array_unique(array_merge($userBoards, $groupBoards, $circleBoards));
131123
}
132124
/**
133125
* @return array

lib/Service/OverviewService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ private function findAllBoardsFromUser(string $userId): array {
140140
$userBoards = $this->boardMapper->findAllByUser($userInfo['user'], null, null);
141141
$groupBoards = $this->boardMapper->findAllByGroups($userInfo['user'], $userInfo['groups'],null, null);
142142
$circleBoards = $this->boardMapper->findAllByCircles($userInfo['user'], null, null);
143-
return array_merge($userBoards, $groupBoards, $circleBoards);
143+
return array_unique(array_merge($userBoards, $groupBoards, $circleBoards));
144144
}
145145

146146
private function getBoardPrerequisites($userId): array {

0 commit comments

Comments
 (0)