fix: outbox, replace client tag

This commit is contained in:
Alejandro Gómez
2026-04-01 15:43:30 +02:00
parent 7fdd91d095
commit aa65ed9911
2 changed files with 18 additions and 2 deletions

View File

@@ -9,9 +9,11 @@ import { getSeenRelays } from "applesauce-core/helpers/relays";
import { EventFactory } from "applesauce-core/event-factory";
import eventStore from "@/services/event-store";
import accountManager from "@/services/accounts";
import settingsManager from "@/services/settings";
import { publishEvent } from "@/services/hub";
import { useAccount } from "@/hooks/useAccount";
import { isAddressableKind } from "@/lib/nostr-kinds";
import { GRIMOIRE_CLIENT_TAG } from "@/constants/app";
import type { FavoriteListConfig } from "@/config/favorite-lists";
import type { NostrEvent } from "@/types/nostr";
import type { EventPointer, AddressPointer } from "nostr-tools/nip19";
@@ -143,6 +145,11 @@ export function useFavoriteList(config: FavoriteListConfig) {
newTags = [...currentTags, buildTag(targetEvent, tagType)];
}
if (settingsManager.getSetting("post", "includeClientTag")) {
newTags = newTags.filter((t) => t[0] !== "client");
newTags.push(GRIMOIRE_CLIENT_TAG);
}
const factory = new EventFactory({ signer: account.signer });
const built = await factory.build({
kind: config.listKind,

View File

@@ -1,5 +1,7 @@
import { useEffect } from "react";
import { useAccount } from "./useAccount";
import { useUserRelays } from "./useUserRelays";
import { useStableArray } from "./useStable";
import { ALL_FAVORITE_LIST_KINDS } from "@/config/favorite-lists";
import { addressLoader } from "@/services/loaders";
@@ -9,14 +11,21 @@ import { addressLoader } from "@/services/loaders";
*/
export function useFavoriteListsSync() {
const { pubkey } = useAccount();
const { outboxRelays } = useUserRelays(pubkey);
const stableRelays = useStableArray(outboxRelays ?? []);
useEffect(() => {
if (!pubkey) return;
const subs = ALL_FAVORITE_LIST_KINDS.map((listKind) =>
addressLoader({ kind: listKind, pubkey, identifier: "" }).subscribe(),
addressLoader({
kind: listKind,
pubkey,
identifier: "",
relays: stableRelays,
}).subscribe(),
);
return () => subs.forEach((s) => s.unsubscribe());
}, [pubkey]);
}, [pubkey, stableRelays]);
}