From 2eeea8e44063d9f503ba0bc59823bb4b986d87c8 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 27 Oct 2025 12:03:32 +0100 Subject: [PATCH 1/3] fix(activity): Reduce stored data size for activity entries Signed-off-by: Joas Schilling --- lib/Activity/ActivityManager.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/Activity/ActivityManager.php b/lib/Activity/ActivityManager.php index 55e2747a2b..764b14bdb4 100644 --- a/lib/Activity/ActivityManager.php +++ b/lib/Activity/ActivityManager.php @@ -520,6 +520,13 @@ private function findDetailsForCard($cardId, $subject = null) { $card = $this->cardMapper->find($cardId); $stack = $this->stackMapper->find($card->getStackId()); $board = $this->boardMapper->find($stack->getBoardId()); + + // Reduce the data size in activity table + $boardArray = [ + 'id' => $board->getId(), + 'title' => $board->getTitle(), + ]; + if ($subject !== self::SUBJECT_CARD_UPDATE_DESCRIPTION) { $card = [ 'id' => $card->getId(), @@ -530,7 +537,7 @@ private function findDetailsForCard($cardId, $subject = null) { return [ 'card' => $card, 'stack' => $stack, - 'board' => $board + 'board' => $boardArray, ]; } From c5883b562b038423e7357113dc77a1af57fe7fc8 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 27 Oct 2025 13:24:27 +0100 Subject: [PATCH 2/3] fix(activity): Also don't log previous description Signed-off-by: Joas Schilling --- lib/Activity/ActivityManager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Activity/ActivityManager.php b/lib/Activity/ActivityManager.php index 764b14bdb4..d6d7860bb5 100644 --- a/lib/Activity/ActivityManager.php +++ b/lib/Activity/ActivityManager.php @@ -406,7 +406,7 @@ private function createEvent($objectType, $entity, $subject, $additionalParams = if ($subject === self::SUBJECT_CARD_UPDATE_DESCRIPTION && isset($params['after'])) { $newContent = $params['after']; - unset($params['before'], $params['after'], $params['card']['description']); + unset($params['before'], $params['after'], $params['card']['description'], $params['card']['descriptionPrev']); $params['after'] = mb_substr($newContent, 0, self::SHORTENED_DESCRIPTION_MAX_LENGTH); if (mb_strlen($newContent) > self::SHORTENED_DESCRIPTION_MAX_LENGTH) { From 70f3288ff364d8f3e3060607da540247b954b18e Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 27 Oct 2025 13:58:57 +0100 Subject: [PATCH 3/3] fix(activity): Adjust tests Signed-off-by: Joas Schilling --- tests/unit/Activity/ActivityManagerTest.php | 49 +++++++++++++-------- 1 file changed, 30 insertions(+), 19 deletions(-) diff --git a/tests/unit/Activity/ActivityManagerTest.php b/tests/unit/Activity/ActivityManagerTest.php index c1036c3d70..b12067d7c1 100644 --- a/tests/unit/Activity/ActivityManagerTest.php +++ b/tests/unit/Activity/ActivityManagerTest.php @@ -149,9 +149,11 @@ public function testCreateEvent() { } public function testCreateEventDescription() { - $board = new Board(); - $board->setId(123); - $board->setTitle(''); + $boardData = [ + 'id' => 123, + 'title' => '' + ]; + $board = Board::fromRow($boardData); $this->boardMapper->expects(self::once()) ->method('find') ->willReturn($board); @@ -173,11 +175,11 @@ public function testCreateEventDescription() { ->willReturn($stack); $expectedCard = $card->jsonSerialize(); - unset($expectedCard['description']); + unset($expectedCard['description'], $expectedCard['descriptionPrev']); $event = $this->expectEventCreation(ActivityManager::SUBJECT_CARD_UPDATE_DESCRIPTION, [ 'card' => $expectedCard, 'stack' => $stack->jsonSerialize(), - 'board' => $board->jsonSerialize(), + 'board' => $boardData, 'diff' => true, 'author' => 'admin', 'after' => str_repeat('C', 2000), @@ -196,9 +198,11 @@ public function testCreateEventDescription() { } public function testCreateEventLongDescription() { - $board = new Board(); - $board->setId(123); - $board->setTitle(''); + $boardData = [ + 'id' => 123, + 'title' => '' + ]; + $board = Board::fromRow($boardData); $this->boardMapper->expects(self::once()) ->method('find') ->willReturn($board); @@ -219,11 +223,11 @@ public function testCreateEventLongDescription() { ->willReturn($stack); $expectedCard = $card->jsonSerialize(); - unset($expectedCard['description']); + unset($expectedCard['description'], $expectedCard['descriptionPrev']); $event = $this->expectEventCreation(ActivityManager::SUBJECT_CARD_UPDATE_DESCRIPTION, [ 'card' => $expectedCard, 'stack' => $stack->jsonSerialize(), - 'board' => $board->jsonSerialize(), + 'board' => $boardData, 'diff' => true, 'author' => 'admin', 'after' => str_repeat('C', 2000) . '...', @@ -242,10 +246,11 @@ public function testCreateEventLongDescription() { } public function testCreateEventLabel() { - $board = Board::fromRow([ + $boardData = [ 'id' => 123, 'title' => 'My board' - ]); + ]; + $board = Board::fromRow($boardData); $this->boardMapper->expects(self::once()) ->method('find') ->willReturn($board); @@ -272,7 +277,7 @@ public function testCreateEventLabel() { 'archived' => false, ], 'stack' => $stack, - 'board' => $board, + 'board' => $boardData, 'author' => 'admin', ]); @@ -426,8 +431,11 @@ public function testFindDetailsForCard() { $stack = new Stack(); $stack->setId(123); $stack->setBoardId(999); - $board = new Board(); - $board->setId(999); + $boardData = [ + 'id' => 999, + 'title' => 'Title', + ]; + $board = Board::fromRow($boardData); $this->cardMapper->expects(self::once()) ->method('find') ->with(555) @@ -441,7 +449,7 @@ public function testFindDetailsForCard() { ->willReturn($board); $this->assertEquals([ 'stack' => $stack, - 'board' => $board, + 'board' => $boardData, 'card' => [ 'id' => $card->getId(), 'title' => $card->getTitle(), @@ -460,8 +468,11 @@ public function testFindDetailsForAttachment() { $stack = new Stack(); $stack->setId(123); $stack->setBoardId(999); - $board = new Board(); - $board->setId(999); + $boardData = [ + 'id' => 999, + 'title' => 'Title', + ]; + $board = Board::fromRow($boardData); $this->cardMapper->expects(self::once()) ->method('find') ->with(555) @@ -475,7 +486,7 @@ public function testFindDetailsForAttachment() { ->willReturn($board); $this->assertEquals([ 'stack' => $stack, - 'board' => $board, + 'board' => $boardData, 'card' => [ 'id' => $card->getId(), 'title' => $card->getTitle(),