feat: hide post

This commit is contained in:
gosangam
2026-06-14 19:52:16 +05:30
parent 7585e6cb31
commit 79f0bd9223
5 changed files with 154 additions and 2 deletions
+18
View File
@@ -94,6 +94,9 @@ export type Post = {
viewer_follows_author?: boolean;
/** Home-feed only: does the author follow the viewer (drives "Follow back")? */
author_follows_viewer?: boolean;
/** Owner-only: post is hidden from timelines + public collections. Still
* shown to the owner on their own profile and in private collections. */
is_hidden?: boolean;
};
/** A comment or reply on a post. Threading is one level deep: `parent_id` is
@@ -180,6 +183,9 @@ export type PublicProfile = {
/** ISO-3166-1 alpha-2 account country, or null when unknown. */
country: string | null;
post_count: number;
/** Owner-only: number of the caller's hidden posts (0 for other viewers).
* Drives the /u/me "Hidden" tab's visibility. */
hidden_count?: number;
follower_count: number;
following_count: number;
relationship: RelationshipState | null;
@@ -247,6 +253,14 @@ export const posts = {
delete(id: string) {
return call<void>(`/posts/${id}`, { method: "DELETE" });
},
/** Hide the post from timelines + public collections (owner-only). */
hide(id: string) {
return call<void>(`/posts/${id}/hide`, { method: "POST" });
},
/** Restore a hidden post to timelines (owner-only). */
unhide(id: string) {
return call<void>(`/posts/${id}/hide`, { method: "DELETE" });
},
/** Swap the post's image set. Empty array removes all images. */
replaceImages(id: string, image_urls: string[]) {
return call<Post>(`/posts/${id}/images`, {
@@ -257,6 +271,10 @@ export const posts = {
mine() {
return call<Post[]>("/posts/mine");
},
/** The caller's hidden posts (owner-only) — drives the /u/me Hidden tab. */
hidden() {
return call<Post[]>("/posts/hidden");
},
/** Record a reshare. Idempotent — calling twice is a no-op server
* side. Resharing your own post is rejected with 400 (not currently
* surfaced as a distinct error type because the UI only ever offers