π¨ The ultimate agentic social media scheduling tool π€
TypeScript nextjsopen-sourceopen-source-social-media-scheduling-toolosspostiz-cloudpostiz-hostedredisscheduling-toolsocial-media-scheduling-tooltypescript
fix(calendar): handle a deleted post group when opening a calendar tile
Gilad Resisic1d553678b9b
diff --git a/apps/frontend/src/components/launches/calendar.tsx b/apps/frontend/src/components/launches/calendar.tsxindex 0f3ae954d..11d82c57a 100644--- a/apps/frontend/src/components/launches/calendar.tsx+++ b/apps/frontend/src/components/launches/calendar.tsx@@ -114,6 +114,11 @@ const usePostActions = (onMutate?: () => void) => {};const data = await (await fetch(`/posts/group/${post.group}`)).json();+ if (!data?.posts?.length) {+ toaster.show(t('post_not_found', 'Post not found'), 'warning');+ mutate();+ return;+ }const date = !isDuplicate? null: (await (await fetch('/posts/find-slot')).json()).date;@@ -170,7 +175,7 @@ const usePostActions = (onMutate?: () => void) => {title: ``,});},- [integrations, fetch, modal, mutate]+ [integrations, fetch, modal, mutate, toaster, t]);const copyDebugJson = useCallback(diff --git a/libraries/nestjs-libraries/src/database/prisma/posts/posts.service.ts b/libraries/nestjs-libraries/src/database/prisma/posts/posts.service.tsindex 875565706..31ecc48bf 100644--- a/libraries/nestjs-libraries/src/database/prisma/posts/posts.service.ts+++ b/libraries/nestjs-libraries/src/database/prisma/posts/posts.service.ts@@ -510,6 +510,9 @@ export class PostsService {const convertToJPEG = false;const loadAll = await this._postRepository.getPostsByGroup(orgId, group);const posts = this.arrangePostsByGroup(loadAll, undefined);+ if (!posts.length) {+ throw new NotFoundException('Post not found');+ }return {group: posts?.[0]?.group,