From e023d527a637797a9daf04cc1e2df77e2f8a9bf1 Mon Sep 17 00:00:00 2001 From: Jared Pereira Date: Tue, 10 Feb 2026 13:23:51 +0400 Subject: [PATCH] don't getpreferences on subscribe --- app/lish/subscribeToPublication.ts | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/app/lish/subscribeToPublication.ts b/app/lish/subscribeToPublication.ts index e321361d..ed712efe 100644 --- a/app/lish/subscribeToPublication.ts +++ b/app/lish/subscribeToPublication.ts @@ -3,10 +3,7 @@ import { AtpBaseClient } from "lexicons/api"; import { AppBskyActorDefs, Agent as BskyAgent } from "@atproto/api"; import { getIdentityData } from "actions/getIdentityData"; -import { - restoreOAuthSession, - OAuthSessionError, -} from "src/atproto-oauth"; +import { restoreOAuthSession, OAuthSessionError } from "src/atproto-oauth"; import { TID } from "@atproto/common"; import { supabaseServerClient } from "supabase/serverClient"; import { revalidatePath } from "next/cache"; @@ -79,8 +76,7 @@ export async function subscribeToPublication( } let bsky = new BskyAgent(credentialSession); - let [prefs, profile, resolveDid] = await Promise.all([ - bsky.app.bsky.actor.getPreferences(), + let [profile, resolveDid] = await Promise.all([ bsky.app.bsky.actor.profile .get({ repo: credentialSession.did!, @@ -96,13 +92,10 @@ export async function subscribeToPublication( handle: resolveDid?.alsoKnownAs?.[0]?.slice(5), }); } - let savedFeeds = prefs.data.preferences.find( - (pref) => pref.$type === "app.bsky.actor.defs#savedFeedsPrefV2", - ) as AppBskyActorDefs.SavedFeedsPrefV2; revalidatePath("/lish/[did]/[publication]", "layout"); return { success: true, - hasFeed: !!savedFeeds.items.find((feed) => feed.value === leafletFeedURI), + hasFeed: true, }; } @@ -111,7 +104,7 @@ type UnsubscribeResult = | { success: false; error: OAuthSessionError }; export async function unsubscribeToPublication( - publication: string + publication: string, ): Promise { let identity = await getIdentityData(); if (!identity || !identity.atp_did) { @@ -144,8 +137,12 @@ export async function unsubscribeToPublication( // Delete from both collections (old and new schema) - one or both may exist let rkey = new AtUri(existingSubscription.uri).rkey; await Promise.all([ - agent.pub.leaflet.graph.subscription.delete({ repo: credentialSession.did!, rkey }).catch(() => {}), - agent.site.standard.graph.subscription.delete({ repo: credentialSession.did!, rkey }).catch(() => {}), + agent.pub.leaflet.graph.subscription + .delete({ repo: credentialSession.did!, rkey }) + .catch(() => {}), + agent.site.standard.graph.subscription + .delete({ repo: credentialSession.did!, rkey }) + .catch(() => {}), ]); await supabaseServerClient -- 2.51.2