From 93d382f25febc87f4087182d661220460393855d Mon Sep 17 00:00:00 2001 From: Divyaswor Makai Date: Sat, 7 Dec 2024 14:57:08 +0545 Subject: [PATCH 1/2] feat: autofill name based on username or let it be empty --- apps/backend/src/api/routes/integrations.controller.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/apps/backend/src/api/routes/integrations.controller.ts b/apps/backend/src/api/routes/integrations.controller.ts index e19e8668..4beb234b 100644 --- a/apps/backend/src/api/routes/integrations.controller.ts +++ b/apps/backend/src/api/routes/integrations.controller.ts @@ -408,9 +408,17 @@ export class IntegrationsController { ); } + let validName = name; + if (!validName) { + if (username) { + validName = username.split('.')[0]; + } else { + validName = ''; + } + } return this._integrationService.createOrUpdateIntegration( org.id, - name, + validName, picture, 'social', String(id), From 515ff8afbb250f7827a767245ddd49ede77eb898 Mon Sep 17 00:00:00 2001 From: Divyaswor Makai Date: Sat, 7 Dec 2024 15:14:09 +0545 Subject: [PATCH 2/2] update: update code wrt rabbit ai --- apps/backend/src/api/routes/integrations.controller.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/backend/src/api/routes/integrations.controller.ts b/apps/backend/src/api/routes/integrations.controller.ts index 4beb234b..64753433 100644 --- a/apps/backend/src/api/routes/integrations.controller.ts +++ b/apps/backend/src/api/routes/integrations.controller.ts @@ -411,14 +411,14 @@ export class IntegrationsController { let validName = name; if (!validName) { if (username) { - validName = username.split('.')[0]; + validName = username.split('.')[0] ?? username; } else { - validName = ''; + validName = `Channel_${String(id).slice(0, 8)}`; } } return this._integrationService.createOrUpdateIntegration( org.id, - validName, + validName.trim(), picture, 'social', String(id),