From 2971e95e1a7be94f47256b6cb088af4aedf609d8 Mon Sep 17 00:00:00 2001
From: Jose Semedo <jose.semedo@cern.ch>
Date: Wed, 27 Apr 2022 09:41:53 +0200
Subject: [PATCH] [HOTFIX] Get channels: support no members or groups in
 relationships

---
 src/controllers/channels/dto.ts | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/controllers/channels/dto.ts b/src/controllers/channels/dto.ts
index 9adacaba..8b2cc29f 100644
--- a/src/controllers/channels/dto.ts
+++ b/src/controllers/channels/dto.ts
@@ -485,8 +485,8 @@ export class ListChannelsFilterObject {
     this.tags = channel.tags;
     this.relationships = new RelationshipResponse(
       channel.notificationCount,
-      channel.members.length,
-      channel.groups.length,
+      channel.members?.length || 0,
+      channel.groups?.length || 0,
     );
     this.channelFlags = channel.channelFlags;
   }
@@ -1371,8 +1371,8 @@ export class ChannelResponse {
     this.sendPrivate = channel.sendPrivate;
     this.relationships = new RelationshipResponse(
       channel.notificationCount,
-      channel.members.length,
-      channel.groups.length,
+      channel.members?.length || 0,
+      channel.groups?.length || 0,
     );
     this.channelFlags = channel.channelFlags;
   }
-- 
GitLab