π¨ The ultimate agentic social media scheduling tool π€
TypeScript nextjsopen-sourceopen-source-social-media-scheduling-toolosspostiz-cloudpostiz-hostedredisscheduling-toolsocial-media-scheduling-tooltypescript
feat: hotfix for mentions
Nevo David142239403c54
diff --git a/apps/backend/src/api/routes/integrations.controller.ts b/apps/backend/src/api/routes/integrations.controller.tsindex da43888a4..1f90e65f8 100644--- a/apps/backend/src/api/routes/integrations.controller.ts+++ b/apps/backend/src/api/routes/integrations.controller.ts@@ -261,24 +261,30 @@ export class IntegrationsController {throw new Error('Invalid integration');}+ let newList: any[] | {none: true} = [];+ try {+ newList = await this.functionIntegration(org, body);+ } catch (err) {}++ if (!Array.isArray(newList) && newList?.none) {+ return newList;+ }+const list = await this._integrationService.getMentions(getIntegration.providerIdentifier,body?.data?.query);- let newList = [];- try {- newList = await this.functionIntegration(org, body);- } catch (err) {}-- if (newList.length) {+ if (Array.isArray(newList) && newList.length) {await this._integrationService.insertMentions(getIntegration.providerIdentifier,- newList.map((p: any) => ({- name: p.label || '',- username: p.id || '',- image: p.image || '',- })).filter((f: any) => f.name)+ newList+ .map((p: any) => ({+ name: p.label || '',+ username: p.id || '',+ image: p.image || '',+ }))+ .filter((f: any) => f.name));}@@ -289,10 +295,10 @@ export class IntegrationsController {image: p.image,label: p.name,})),- ...newList,+ ...newList as any[],],(p) => p.id- ).filter(f => f.label && f.image && f.id);+ ).filter((f) => f.label && f.image && f.id);}@Post('/function')diff --git a/apps/frontend/src/components/new-launch/editor.tsx b/apps/frontend/src/components/new-launch/editor.tsxindex 333cb3081..5105ac7d4 100644--- a/apps/frontend/src/components/new-launch/editor.tsx+++ b/apps/frontend/src/components/new-launch/editor.tsx@@ -52,10 +52,7 @@ import Heading from '@tiptap/extension-heading';import { HeadingComponent } from '@gitroom/frontend/components/new-launch/heading.component';import Mention from '@tiptap/extension-mention';import { suggestion } from '@gitroom/frontend/components/new-launch/mention.component';-import { useCustomProviderFunction } from '@gitroom/frontend/components/launches/helpers/use.custom.provider.function';-import { useIntegration } from '@gitroom/frontend/components/launches/helpers/use.integration';import { useFetch } from '@gitroom/helpers/utils/custom.fetch';-import { useDebouncedCallback } from 'use-debounce';const InterceptBoldShortcut = Extension.create({name: 'preventBoldWithUnderline',diff --git a/apps/frontend/src/components/new-launch/mention.component.tsx b/apps/frontend/src/components/new-launch/mention.component.tsxindex 8de4fb553..3f93caeb4 100644--- a/apps/frontend/src/components/new-launch/mention.component.tsx+++ b/apps/frontend/src/components/new-launch/mention.component.tsx@@ -91,7 +91,7 @@ const MentionList: FC = (props: any) => {props.items.length === 0 ? (<div className="p-2 text-gray-500 text-center">No results found</div>) : (- props.items.map((item: any, index: any) => (+ props?.items?.map((item: any, index: any) => (<buttonclassName={`flex gap-[10px] w-full p-2 text-left rounded hover:bg-gray-100 ${index === selectedIndex ? 'bg-blue-100' : ''