From 55d283c264ae31abb1d1ed23f2896ed32c9fe51b Mon Sep 17 00:00:00 2001 From: billisdead Date: Fri, 22 May 2026 13:19:41 +0200 Subject: [PATCH] fix: reschedule via delete+recreate, sort posts chrono, show account name - Reschedule: Postiz public API v1 has no PUT/PATCH on posts; implement as delete + recreate with updated date and same content/integrations - Posts list: sort ascending by publishDate so nearest post appears first - PostCard footer: show integration name (or identifier) before the timestamp, truncated to 2 accounts with +N overflow Co-Authored-By: Claude Sonnet 4.6 --- artifacts/postiz-mobile/app/(tabs)/posts.tsx | 26 +++++++++++++++---- .../postiz-mobile/components/PostCard.tsx | 22 ++++++++++++++++ 2 files changed, 43 insertions(+), 5 deletions(-) diff --git a/artifacts/postiz-mobile/app/(tabs)/posts.tsx b/artifacts/postiz-mobile/app/(tabs)/posts.tsx index bb53af2..ef2770a 100644 --- a/artifacts/postiz-mobile/app/(tabs)/posts.tsx +++ b/artifacts/postiz-mobile/app/(tabs)/posts.tsx @@ -86,10 +86,15 @@ export default function PostsScreen() { staleTime: 0, }); - const filteredPosts = - filter === "all" - ? posts ?? [] - : (posts ?? []).filter((p) => p.state === filter); + const filteredPosts = useMemo(() => { + const list = + filter === "all" + ? posts ?? [] + : (posts ?? []).filter((p) => p.state === filter); + return [...list].sort( + (a, b) => new Date(a.publishDate).getTime() - new Date(b.publishDate).getTime() + ); + }, [posts, filter]); const handleRefresh = async () => { setRefreshing(true); @@ -152,8 +157,19 @@ export default function PostsScreen() { const submitReschedule = async (post: PostizPost, date: Date) => { if (!client) return; + const integrations = post.integrations ?? (post.integration ? [post.integration] : []); try { - await client.put(`posts/${post.id}`, { date: date.toISOString() }); + await client.delete(`posts/${post.id}`); + await client.post("posts", { + type: "schedule", + date: date.toISOString(), + shortLink: false, + tags: [] as string[], + posts: integrations.map((intg) => ({ + integration: { id: intg.id }, + value: [{ content: post.content, image: post.image ?? [] }], + })), + }); queryClient.invalidateQueries({ queryKey: ["posts-list"] }); Haptics.notificationAsync(Haptics.NotificationFeedbackType.Success); Alert.alert("Rescheduled", `Post moved to ${date.toLocaleDateString("en-US", { month: "short", day: "numeric", hour: "2-digit", minute: "2-digit" })}`); diff --git a/artifacts/postiz-mobile/components/PostCard.tsx b/artifacts/postiz-mobile/components/PostCard.tsx index 0c98146..f103f33 100644 --- a/artifacts/postiz-mobile/components/PostCard.tsx +++ b/artifacts/postiz-mobile/components/PostCard.tsx @@ -139,6 +139,19 @@ export function PostCard({ post, onDelete, onLongPress }: PostCardProps) { {truncatedContent} + {integrations.length > 0 && ( + <> + + {integrations + .slice(0, 2) + .map((i) => i.name || i.identifier || "") + .filter(Boolean) + .join(", ")} + {integrations.length > 2 ? ` +${integrations.length - 2}` : ""} + + ยท + + )} {formatDate(post.publishDate)} @@ -191,6 +204,15 @@ const styles = StyleSheet.create({ fontSize: 12, fontFamily: "Inter_400Regular", }, + accountName: { + fontSize: 12, + fontFamily: "Inter_400Regular", + flexShrink: 1, + }, + dot: { + fontSize: 12, + marginHorizontal: 3, + }, deleteAction: { width: 72, alignItems: "center",