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

@@ -234,7 +234,9 @@ class NoteView extends PureComponent<NoteViewProps, State> {
this.reloadEditorComponent().catch(console.error)
this.reloadStackComponents().catch(console.error)
const showProtectedWarning = this.note.protected && !this.application.hasProtectionSources()
const showProtectedWarning =
this.note.protected &&
(!this.application.hasProtectionSources() || !this.application.hasUnprotectedAccessSession())
this.setShowProtectedOverlay(showProtectedWarning)
this.reloadPreferences().catch(console.error)
@@ -935,7 +937,7 @@ class NoteView extends PureComponent<NoteViewProps, State> {
}
override render() {
if (this.state.showProtectedWarning) {
if (this.state.showProtectedWarning || !this.application.isAuthorizedToRenderItem(this.note)) {
return (
<ProtectedItemOverlay
viewControllerManager={this.viewControllerManager}