diff --git a/src/components/NoteOptions/useMenuActions.tsx b/src/components/NoteOptions/useMenuActions.tsx index fb6923dd..1748c203 100644 --- a/src/components/NoteOptions/useMenuActions.tsx +++ b/src/components/NoteOptions/useMenuActions.tsx @@ -850,8 +850,8 @@ export function useMenuActions({ }) } - // Delete functionality only available for own notes - if (pubkey && event.pubkey === pubkey) { + // Delete only when signed in as the author with a signing key (not read-only npub) + if (canSignEvents && pubkey && event.pubkey === pubkey) { actions.push({ icon: Trash2, label: t('Try deleting this note'), diff --git a/src/pages/primary/SpellsPage/index.tsx b/src/pages/primary/SpellsPage/index.tsx index 2392e09b..5a0dbdfc 100644 --- a/src/pages/primary/SpellsPage/index.tsx +++ b/src/pages/primary/SpellsPage/index.tsx @@ -310,7 +310,8 @@ const SpellsPage = forwardRef(function SpellsPage( ) { const { t } = useTranslation() const { navigate: navigatePrimary } = usePrimaryPage() - const { pubkey, relayList, attemptDelete, bookmarkListEvent, interestListEvent } = useNostr() + const { pubkey, account, relayList, attemptDelete, bookmarkListEvent, interestListEvent } = + useNostr() const { addBookmark, removeBookmark } = useBookmarks() const { hideUntrustedNotifications } = useUserTrust() const { isSmallScreen } = useScreenSize() @@ -1179,7 +1180,9 @@ const SpellsPage = forwardRef(function SpellsPage( [logSpellFeedPickerSelection, navigatePrimary, selectedFauxSpell, selectedSpell] ) - const selectedSpellIsOwn = !!(pubkey && selectedSpell && selectedSpell.pubkey === pubkey) + const canSignSpellActions = account != null && account.signerType !== 'npub' + const selectedSpellIsAuthor = !!(pubkey && selectedSpell && selectedSpell.pubkey === pubkey) + const selectedSpellCanEditOrDelete = selectedSpellIsAuthor && canSignSpellActions const handleSpellFeedFirstPaint = useCallback( (detail: { eventCount: number; firstEventId: string }) => { @@ -1588,7 +1591,7 @@ const SpellsPage = forwardRef(function SpellsPage( - {selectedSpellIsOwn ? ( + {selectedSpellCanEditOrDelete ? ( { @@ -1617,7 +1620,7 @@ const SpellsPage = forwardRef(function SpellsPage( {t('View definition')} - {selectedSpellIsOwn ? ( + {selectedSpellCanEditOrDelete ? ( <> { const { t } = useTranslation() - const { pubkey, publish, attemptDelete, checkLogin, relayList } = useNostr() + const { pubkey, account, publish, attemptDelete, checkLogin, relayList } = useNostr() const { favoriteRelays, blockedRelays } = useFavoriteRelays() const [lists, setLists] = useState([]) const [loading, setLoading] = useState(true) @@ -74,6 +74,8 @@ const FollowSetsSettingsPage = forwardRef( const [deleteTarget, setDeleteTarget] = useState(null) const [deleting, setDeleting] = useState(false) + const canSignEvents = account != null && account.signerType !== 'npub' + const { registerPrimaryPanelRefresh } = usePrimaryNoteView() const buildReadRelays = useCallback((): string[] => { @@ -275,17 +277,19 @@ const FollowSetsSettingsPage = forwardRef( {t('Edit')} - + {canSignEvents && ev.pubkey === pubkey ? ( + + ) : null} ))}