From 31db72638b72d659924f0fc09cdd645276a3c94a Mon Sep 17 00:00:00 2001 From: Paulo Castellano Date: Tue, 19 May 2026 14:38:05 -0300 Subject: [PATCH] =?UTF-8?q?fix(posts):=20align=20Index/Calendar=20routing?= =?UTF-8?q?=20with=20Failed=E2=86=92show=20redirect?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Drop 'failed' from EDITABLE_STATUSES in Index.vue and Calendar.vue so failed posts link directly to /show instead of /edit (which now redirects). - Replace remaining 'scheduled'/'publishing' literals in PostEditorHeader.vue with the PostStatus enum. - Include Failed in PostEditorHeader's READONLY_STATUSES to match Edit.vue. - Split PLATFORM_VARIANTS by Platform key (Platform.LinkedInPage and Platform.InstagramFacebook were missing; page content types were grouped under the wrong personal-LinkedIn key). --- resources/js/components/posts/editor/PostEditorHeader.vue | 4 ++-- resources/js/pages/posts/Calendar.vue | 5 ++++- resources/js/pages/posts/Edit.vue | 4 +++- resources/js/pages/posts/Index.vue | 4 +++- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/resources/js/components/posts/editor/PostEditorHeader.vue b/resources/js/components/posts/editor/PostEditorHeader.vue index d673d841..82c3b3bb 100644 --- a/resources/js/components/posts/editor/PostEditorHeader.vue +++ b/resources/js/components/posts/editor/PostEditorHeader.vue @@ -28,7 +28,7 @@ const emit = defineEmits<{ (e: 'submit', status: string): void; }>(); -const READONLY_STATUSES: readonly string[] = [PostStatus.Publishing, PostStatus.Published, PostStatus.PartiallyPublished]; +const READONLY_STATUSES: readonly string[] = [PostStatus.Publishing, PostStatus.Published, PostStatus.PartiallyPublished, PostStatus.Failed]; const PUBLISHED_STATUSES: readonly string[] = [PostStatus.Published, PostStatus.PartiallyPublished]; const isReadOnly = computed(() => READONLY_STATUSES.includes(props.post.status)); @@ -125,7 +125,7 @@ const isPublished = computed(() => PUBLISHED_STATUSES.includes(props.post.status type="button" :disabled="isPostActionDisabled" :title="postActionTooltip" - @click="emit('submit', hasPickedTime ? 'scheduled' : 'publishing')" + @click="emit('submit', hasPickedTime ? PostStatus.Scheduled : PostStatus.Publishing)" > {{ hasPickedTime ? $t('posts.edit.schedule') : $t('posts.edit.post_now') }} diff --git a/resources/js/pages/posts/Calendar.vue b/resources/js/pages/posts/Calendar.vue index 791c144e..1d93b385 100644 --- a/resources/js/pages/posts/Calendar.vue +++ b/resources/js/pages/posts/Calendar.vue @@ -13,6 +13,7 @@ import dayjs from '@/dayjs'; import AppLayout from '@/layouts/AppLayout.vue'; import { calendar } from '@/routes/app'; import { create as createPost, edit as editPost, show as showPost } from '@/routes/app/posts'; +import { PostStatus } from '@/types/post'; interface PostPlatform { id: string; @@ -230,8 +231,10 @@ const getStatusColor = (status: string): string => { return colors[status] ?? colors.draft; }; +const EDITABLE_STATUSES: readonly string[] = [PostStatus.Draft, PostStatus.Scheduled]; + const getPostUrl = (post: Post): string => { - return ['draft', 'scheduled', 'failed'].includes(post.status) + return EDITABLE_STATUSES.includes(post.status) ? editPost.url(post.id) : showPost.url(post.id); }; diff --git a/resources/js/pages/posts/Edit.vue b/resources/js/pages/posts/Edit.vue index f6568d5e..d312cab1 100644 --- a/resources/js/pages/posts/Edit.vue +++ b/resources/js/pages/posts/Edit.vue @@ -221,7 +221,9 @@ const getMediaIncompatibilityReason = (contentType: string, mediaItems: MediaIte const PLATFORM_VARIANTS: Record = { [Platform.Facebook]: [ContentType.FacebookPost, ContentType.FacebookReel, ContentType.FacebookStory], [Platform.Instagram]: [ContentType.InstagramFeed, ContentType.InstagramReel, ContentType.InstagramStory], - [Platform.LinkedIn]: [ContentType.LinkedInPost, ContentType.LinkedInCarousel, ContentType.LinkedInPagePost, ContentType.LinkedInPageCarousel], + [Platform.InstagramFacebook]: [ContentType.InstagramFeed, ContentType.InstagramReel, ContentType.InstagramStory], + [Platform.LinkedIn]: [ContentType.LinkedInPost, ContentType.LinkedInCarousel], + [Platform.LinkedInPage]: [ContentType.LinkedInPagePost, ContentType.LinkedInPageCarousel], [Platform.TikTok]: [ContentType.TikTokVideo, ContentType.TikTokPhoto], [Platform.Pinterest]: [ContentType.PinterestPin, ContentType.PinterestVideoPin, ContentType.PinterestCarousel], }; diff --git a/resources/js/pages/posts/Index.vue b/resources/js/pages/posts/Index.vue index f81a4fbe..ad70d20b 100644 --- a/resources/js/pages/posts/Index.vue +++ b/resources/js/pages/posts/Index.vue @@ -37,6 +37,7 @@ import dayjs from '@/dayjs'; import debounce from '@/debounce'; import AppLayout from '@/layouts/AppLayout.vue'; import { copyToClipboard } from '@/lib/utils'; +import { PostStatus } from '@/types/post'; interface SocialAccount { id: string; platform: string; @@ -136,7 +137,8 @@ const getEnabledPlatforms = (post: Post) => post.post_platforms.filter((pp) => p const getPostPreview = (post: Post): string => post.content?.trim() || trans('calendar.no_content'); -const canEdit = (post: Post): boolean => ['draft', 'scheduled', 'failed'].includes(post.status); +const EDITABLE_STATUSES: readonly string[] = [PostStatus.Draft, PostStatus.Scheduled]; +const canEdit = (post: Post): boolean => EDITABLE_STATUSES.includes(post.status); const postUrl = (post: Post): string => canEdit(post) ? editPost.url(post.id) : showPost.url(post.id);