Include 'e' tag in active theme deletion events

Pass the event ID of the active profile theme to clearActiveTheme so
the kind 5 deletion includes both an 'a' tag and an 'e' tag. Updated
all call sites (ThemeSelector and EditProfileForm).
This commit is contained in:
Alex Gleason
2026-02-26 04:12:31 -06:00
parent 808d44aeff
commit 5ca237e8a6
3 changed files with 12 additions and 7 deletions
+1 -1
View File
@@ -500,7 +500,7 @@ function ShareThemeSection() {
} else {
try {
setIsDeleting(true);
await clearActiveTheme();
await clearActiveTheme(activeThemeQuery.data?.event.id);
activeThemeQuery.refetch();
toast({ title: 'Theme removed', description: 'Your profile theme is no longer shared.' });
} catch (error) {
+1 -1
View File
@@ -121,7 +121,7 @@ export function ThemeSelector() {
await setActiveTheme({ colors });
toast({ title: 'Theme shared', description: 'Your theme is now visible on your profile.' });
} else {
await clearActiveTheme();
await clearActiveTheme(activeProfileTheme.data?.event.id);
toast({ title: 'Theme hidden', description: 'Your theme is no longer visible on your profile.' });
}
} catch {
+10 -5
View File
@@ -98,16 +98,21 @@ export function usePublishTheme() {
}, [user, publishEvent, queryClient]);
/** Clear the active profile theme (kind 5 deletion of kind 11667). */
const clearActiveTheme = useCallback(async () => {
const clearActiveTheme = useCallback(async (eventId?: string) => {
if (!user) throw new Error('Must be logged in');
const tags: string[][] = [
['a', `${ACTIVE_THEME_KIND}:${user.pubkey}:`],
['k', String(ACTIVE_THEME_KIND)],
];
if (eventId) {
tags.push(['e', eventId]);
}
await publishEvent({
kind: 5,
content: '',
tags: [
['a', `${ACTIVE_THEME_KIND}:${user.pubkey}:`],
['k', String(ACTIVE_THEME_KIND)],
],
tags,
});
queryClient.invalidateQueries({ queryKey: ['activeProfileTheme', user.pubkey] });