Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions lib/Db/CardMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,16 +230,18 @@ public function findAllWithDue($boardId) {
return $this->findEntities($qb);
}

public function findAssignedCards($boardId, $username) {
public function findToMeOrNotAssignedCards($boardId, $username) {
$qb = $this->db->getQueryBuilder();
$qb->select('c.*')
->from('deck_cards', 'c')
->innerJoin('c', 'deck_stacks', 's', 's.id = c.stack_id')
->innerJoin('s', 'deck_boards', 'b', 'b.id = s.board_id')
->innerJoin('c', 'deck_assigned_users', 'u', 'c.id = u.card_id')
->leftJoin('c', 'deck_assigned_users', 'u', 'c.id = u.card_id')
->where($qb->expr()->eq('s.board_id', $qb->createNamedParameter($boardId, IQueryBuilder::PARAM_INT)))
->andWhere($qb->expr()->eq('u.participant', $qb->createNamedParameter($username, IQueryBuilder::PARAM_STR)))
->andWhere($qb->expr()->eq('u.type', $qb->createNamedParameter(Acl::PERMISSION_TYPE_USER, IQueryBuilder::PARAM_INT)))
->andWhere($qb->expr()->orX(
$qb->expr()->eq('u.participant', $qb->createNamedParameter($username, IQueryBuilder::PARAM_STR)),
$qb->expr()->isNull('u.participant'))
)
// Filter out archived/deleted cards and board
->andWhere($qb->expr()->eq('c.archived', $qb->createNamedParameter(false, IQueryBuilder::PARAM_BOOL)))
->andWhere($qb->expr()->eq('c.deleted_at', $qb->createNamedParameter(0, IQueryBuilder::PARAM_INT)))
Expand Down
12 changes: 0 additions & 12 deletions lib/Service/CardService.php
Original file line number Diff line number Diff line change
Expand Up @@ -608,16 +608,4 @@ public function findAllWithDue($userId) {

return $cards;
}

/**
*
* @return array
* @throws \OCA\Deck\NoPermissionException
* @throws BadRequestException
*/
public function findAssignedCards($userId) {
$cards = $this->cardMapper->findAssignedCards($userId);

return $cards;
}
}
6 changes: 3 additions & 3 deletions lib/Service/OverviewService.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,21 +114,21 @@ public function findUpcomingCards(string $userId): array {
$service = $this;

if (count($userBoard->getAcl()) === 0) {
// get cards with due date
// private board: get cards with due date
$findCards[] = array_map(static function ($card) use ($service, $userBoard, $userId) {
$service->enrich($card, $userId);
$cardData = $card->jsonSerialize();
$cardData['boardId'] = $userBoard->getId();
return $cardData;
}, $this->cardMapper->findAllWithDue($userBoard->getId()));
} else {
// get assigned cards
// shared board: get all my assigned or unassigned cards
$findCards[] = array_map(static function ($card) use ($service, $userBoard, $userId) {
$service->enrich($card, $userId);
$cardData = $card->jsonSerialize();
$cardData['boardId'] = $userBoard->getId();
return $cardData;
}, $this->cardMapper->findAssignedCards($userBoard->getId(), $userId));
}, $this->cardMapper->findToMeOrNotAssignedCards($userBoard->getId(), $userId));
}
}
return $findCards;
Expand Down
2 changes: 1 addition & 1 deletion src/components/cards/CardBadges.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export default {
if (this.card.commentsUnread > 0) {
return t('deck', '{count} comments, {unread} unread', {
count: this.card.commentsCount,
unread: this.card.commentsUnread
unread: this.card.commentsUnread,
})
}
return null
Expand Down