Compare commits
1 Commits
get-cards-
...
dependabot
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
26c9cfe6bc |
8
composer.lock
generated
8
composer.lock
generated
@@ -380,12 +380,12 @@
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/nextcloud-deps/ocp.git",
|
||||
"reference": "c2c75ad8fdc54cbc6341764b5a2a8ecf860e6160"
|
||||
"reference": "8ec87be7ab634f12a403fca7165319587a6cb218"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/nextcloud-deps/ocp/zipball/c2c75ad8fdc54cbc6341764b5a2a8ecf860e6160",
|
||||
"reference": "c2c75ad8fdc54cbc6341764b5a2a8ecf860e6160",
|
||||
"url": "https://api.github.com/repos/nextcloud-deps/ocp/zipball/8ec87be7ab634f12a403fca7165319587a6cb218",
|
||||
"reference": "8ec87be7ab634f12a403fca7165319587a6cb218",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -421,7 +421,7 @@
|
||||
"issues": "https://github.com/nextcloud-deps/ocp/issues",
|
||||
"source": "https://github.com/nextcloud-deps/ocp/tree/master"
|
||||
},
|
||||
"time": "2025-08-10T01:01:23+00:00"
|
||||
"time": "2025-07-26T00:55:00+00:00"
|
||||
},
|
||||
{
|
||||
"name": "nikic/php-parser",
|
||||
|
||||
@@ -3,7 +3,6 @@ OC.L10N.register(
|
||||
{
|
||||
"Missing a temporary folder" : "Адсутнічае часовая папка",
|
||||
"Could not write file to disk" : "Не ўдалося запісаць файл на дыск",
|
||||
"A PHP extension stopped the file upload" : "Пашырэнне PHP спыніла запампоўванне файла",
|
||||
"copy" : "копія",
|
||||
"Done" : "Гатова",
|
||||
"File" : "Файл",
|
||||
@@ -23,16 +22,13 @@ OC.L10N.register(
|
||||
"Modified" : "Зменены",
|
||||
"Save" : "Захаваць",
|
||||
"Created:" : "Створана:",
|
||||
"Reply" : "Адказаць",
|
||||
"Open link" : "Адкрыць спасылку",
|
||||
"seconds ago" : "с таму",
|
||||
"Keyboard shortcuts" : "Спалучэнні клавіш",
|
||||
"Keyboard shortcut" : "Спалучэнне клавіш",
|
||||
"Action" : "Дзеянне",
|
||||
"Search" : "Пошук",
|
||||
"Shared with you" : "Абагулена з вамі",
|
||||
"An error occurred" : "Узнікла памылка",
|
||||
"No notifications" : "Няма апавяшчэнняў",
|
||||
"Today" : "Сёння",
|
||||
"Close" : "Закрыць",
|
||||
"Share" : "Абагуліць"
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
{ "translations": {
|
||||
"Missing a temporary folder" : "Адсутнічае часовая папка",
|
||||
"Could not write file to disk" : "Не ўдалося запісаць файл на дыск",
|
||||
"A PHP extension stopped the file upload" : "Пашырэнне PHP спыніла запампоўванне файла",
|
||||
"copy" : "копія",
|
||||
"Done" : "Гатова",
|
||||
"File" : "Файл",
|
||||
@@ -21,16 +20,13 @@
|
||||
"Modified" : "Зменены",
|
||||
"Save" : "Захаваць",
|
||||
"Created:" : "Створана:",
|
||||
"Reply" : "Адказаць",
|
||||
"Open link" : "Адкрыць спасылку",
|
||||
"seconds ago" : "с таму",
|
||||
"Keyboard shortcuts" : "Спалучэнні клавіш",
|
||||
"Keyboard shortcut" : "Спалучэнне клавіш",
|
||||
"Action" : "Дзеянне",
|
||||
"Search" : "Пошук",
|
||||
"Shared with you" : "Абагулена з вамі",
|
||||
"An error occurred" : "Узнікла памылка",
|
||||
"No notifications" : "Няма апавяшчэнняў",
|
||||
"Today" : "Сёння",
|
||||
"Close" : "Закрыць",
|
||||
"Share" : "Абагуліць"
|
||||
|
||||
@@ -274,7 +274,6 @@ OC.L10N.register(
|
||||
"{count} comments, {unread} unread" : "コメント {count} 件あり、 {unread} 件未読",
|
||||
"Todo items" : "Todo項目",
|
||||
"Edit card title" : "カードタイトルを編集する",
|
||||
"Open link" : "リンクを開く",
|
||||
"Card deleted" : "カードが削除されました",
|
||||
"Edit title" : "タイトルを編集",
|
||||
"Assign to me" : "自分に割り当てる",
|
||||
|
||||
@@ -272,7 +272,6 @@
|
||||
"{count} comments, {unread} unread" : "コメント {count} 件あり、 {unread} 件未読",
|
||||
"Todo items" : "Todo項目",
|
||||
"Edit card title" : "カードタイトルを編集する",
|
||||
"Open link" : "リンクを開く",
|
||||
"Card deleted" : "カードが削除されました",
|
||||
"Edit title" : "タイトルを編集",
|
||||
"Assign to me" : "自分に割り当てる",
|
||||
|
||||
@@ -274,7 +274,6 @@ OC.L10N.register(
|
||||
"{count} comments, {unread} unread" : "{count} комментариев, {unread} непрочитано",
|
||||
"Todo items" : "Элементы списка задач",
|
||||
"Edit card title" : "Изменить заголовок карточки",
|
||||
"Open link" : "Открыть ссылку",
|
||||
"Card deleted" : "Карточка удалена",
|
||||
"Edit title" : "Редактировать заголовок",
|
||||
"Assign to me" : "Назначить себе",
|
||||
|
||||
@@ -272,7 +272,6 @@
|
||||
"{count} comments, {unread} unread" : "{count} комментариев, {unread} непрочитано",
|
||||
"Todo items" : "Элементы списка задач",
|
||||
"Edit card title" : "Изменить заголовок карточки",
|
||||
"Open link" : "Открыть ссылку",
|
||||
"Card deleted" : "Карточка удалена",
|
||||
"Edit title" : "Редактировать заголовок",
|
||||
"Assign to me" : "Назначить себе",
|
||||
|
||||
@@ -19,7 +19,6 @@ use OCA\Deck\Db\CardMapper;
|
||||
use OCA\Deck\Db\ChangeHelper;
|
||||
use OCA\Deck\Db\Label;
|
||||
use OCA\Deck\Db\LabelMapper;
|
||||
use OCA\Deck\Db\Stack;
|
||||
use OCA\Deck\Db\StackMapper;
|
||||
use OCA\Deck\Event\CardCreatedEvent;
|
||||
use OCA\Deck\Event\CardDeletedEvent;
|
||||
@@ -65,47 +64,31 @@ class CardService {
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Card[] $cards
|
||||
* @return CardDetails[]
|
||||
*/
|
||||
public function enrichCards(array $cards, Stack $stack = null): array {
|
||||
if (!$cards) {
|
||||
return [];
|
||||
}
|
||||
|
||||
public function enrichCards($cards) {
|
||||
$user = $this->userManager->get($this->userId);
|
||||
|
||||
$cardIds = array_map(function (Card $card) use ($user, $stack) {
|
||||
$cardIds = array_map(function (Card $card) use ($user) {
|
||||
// Everything done in here might be heavy as it is executed for every card
|
||||
$cardId = $card->getId();
|
||||
$this->cardMapper->mapOwner($card);
|
||||
|
||||
$card->setAttachmentCount($this->attachmentService->count($cardId));
|
||||
|
||||
if ($stack === null) {
|
||||
$stack = $this->stackMapper->find($card->getStackId());
|
||||
}
|
||||
// TODO We should find a better way just to get the comment count so we can save 1-3 queries per card here
|
||||
$countComments = $this->commentsManager->getNumberOfCommentsForObject('deckCard', (string)$card->getId());
|
||||
$lastRead = $countComments > 0 ? $this->commentsManager->getReadMark('deckCard', (string)$card->getId(), $user) : null;
|
||||
$countUnreadComments = $lastRead ? $this->commentsManager->getNumberOfCommentsForObject('deckCard', (string)$card->getId(), $lastRead) : 0;
|
||||
$card->setCommentsUnread($countUnreadComments);
|
||||
$card->setCommentsCount($countComments);
|
||||
|
||||
$stack = $this->stackMapper->find($card->getStackId());
|
||||
$board = $this->boardService->find($stack->getBoardId(), false);
|
||||
$card->setRelatedStack($stack);
|
||||
$card->setRelatedBoard($board);
|
||||
|
||||
return $cardId;
|
||||
return $card->getId();
|
||||
}, $cards);
|
||||
|
||||
$commentsCountPerCardId = $this->commentsManager->getNumberOfCommentsForObjects('deckCard', $cardIds);
|
||||
$unreadCommentsCountPerCardId = $this->commentsManager->getNumberOfUnreadCommentsForObjects('deckCard', $cardIds, $user);
|
||||
|
||||
foreach ($commentsCountPerCardId as $cardId => $commentCounts) {
|
||||
foreach ($cards as $card) {
|
||||
if ($card->getId() === $cardId) {
|
||||
$card->setCommentsUnread($unreadCommentsCountPerCardId[$cardId]);
|
||||
$card->setCommentsCount($commentCounts);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$assignedLabels = $this->labelMapper->findAssignedLabelsForCards($cardIds);
|
||||
$assignedUsers = $this->assignedUsersMapper->findIn($cardIds);
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ class StackService {
|
||||
return;
|
||||
}
|
||||
|
||||
$stack->setCards($this->cardService->enrichCards($cards, $stack));
|
||||
$stack->setCards($this->cardService->enrichCards($cards));
|
||||
}
|
||||
|
||||
private function enrichStacksWithCards($stacks, $since = -1) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "~9",
|
||||
"phpunit/phpunit": "~12",
|
||||
"behat/behat": "~3.23.0",
|
||||
"guzzlehttp/guzzle": "7.9.2",
|
||||
"jarnaiz/behat-junit-formatter": "^1.3",
|
||||
|
||||
Reference in New Issue
Block a user