refactor: add redundant protection checks (#1822)

This commit is contained in:
Mo
2022-10-18 10:15:14 -05:00
committed by GitHub
parent eec7ae1589
commit 07ffc01ede
7 changed files with 36 additions and 2 deletions

View File

@@ -18,6 +18,7 @@ import { AppPaneId } from '../ResponsivePane/AppPaneMetadata'
import { getNoteBlob, getNoteFileName } from '@/Utils/NoteExportUtils'
import { shareSelectedNotes } from '@/NativeMobileWeb/ShareSelectedNotes'
import { downloadSelectedNotesOnAndroid } from '@/NativeMobileWeb/DownloadSelectedNotesOnAndroid'
import ProtectedUnauthorizedLabel from '../ProtectedItemOverlay/ProtectedUnauthorizedLabel'
type DeletePermanentlyButtonProps = {
onClick: () => void
@@ -267,6 +268,11 @@ const NotesOptions = ({
historyModalController.openModal(notesController.firstSelectedNote)
}, [historyModalController, notesController.firstSelectedNote])
const unauthorized = notes.some((note) => !application.isAuthorizedToRenderItem(note))
if (unauthorized) {
return <ProtectedUnauthorizedLabel />
}
return (
<>
{notes.length === 1 && (