fix(posts): align Index/Calendar routing with Failed→show redirect

- 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).
This commit is contained in:
Paulo Castellano 2026-05-19 14:38:05 -03:00
parent 2902506f35
commit 31db72638b
4 changed files with 12 additions and 5 deletions

View file

@ -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') }}
</Button>

View file

@ -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);
};

View file

@ -221,7 +221,9 @@ const getMediaIncompatibilityReason = (contentType: string, mediaItems: MediaIte
const PLATFORM_VARIANTS: Record<string, string[]> = {
[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],
};

View file

@ -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);