From 74a7ffbf7a0fc9bb481cdfded17be23fa478c976 Mon Sep 17 00:00:00 2001 From: Steven Nguyen Date: Thu, 11 Jan 2024 02:06:56 +0000 Subject: [PATCH] Default topic description to an empty string instead of null Not using nulls makes things more type safe. --- app/controllers/api/messaging.php | 5 +---- tests/e2e/Services/Messaging/MessagingBase.php | 1 + 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/app/controllers/api/messaging.php b/app/controllers/api/messaging.php index 9a9fdb8b16..d2334caf10 100644 --- a/app/controllers/api/messaging.php +++ b/app/controllers/api/messaging.php @@ -1696,12 +1696,9 @@ App::post('/v1/messaging/topics') $topic = new Document([ '$id' => $topicId, 'name' => $name, + 'description' => $description ]); - if ($description) { - $topic->setAttribute('description', $description); - } - try { $topic = $dbForProject->createDocument('topics', $topic); } catch (DuplicateException) { diff --git a/tests/e2e/Services/Messaging/MessagingBase.php b/tests/e2e/Services/Messaging/MessagingBase.php index bb09e0a247..8047666060 100644 --- a/tests/e2e/Services/Messaging/MessagingBase.php +++ b/tests/e2e/Services/Messaging/MessagingBase.php @@ -245,6 +245,7 @@ trait MessagingBase ]); $this->assertEquals(201, $response['headers']['status-code']); $this->assertEquals('my-app', $response['body']['name']); + $this->assertEquals('', $response['body']['description']); return $response['body']; }