fix: Fixed issue where multiple trashed items on mobile could not be deleted permanently
This commit is contained in:
@@ -382,7 +382,7 @@ const ContentListView = forwardRef<HTMLDivElement, Props>(
|
|||||||
)
|
)
|
||||||
) : null}
|
) : null}
|
||||||
{isMobileScreen && itemListController.isMultipleSelectionMode && (
|
{isMobileScreen && itemListController.isMultipleSelectionMode && (
|
||||||
<MobileMultiSelectionToolbar notesController={notesController} />
|
<MobileMultiSelectionToolbar notesController={notesController} navigationController={navigationController} />
|
||||||
)}
|
)}
|
||||||
<div className="absolute bottom-0 h-safe-bottom w-full" />
|
<div className="absolute bottom-0 h-safe-bottom w-full" />
|
||||||
{children}
|
{children}
|
||||||
|
|||||||
@@ -1,12 +1,17 @@
|
|||||||
import { NotesController } from '@/Controllers/NotesController/NotesController'
|
import { NotesController } from '@/Controllers/NotesController/NotesController'
|
||||||
import Icon from '../Icon/Icon'
|
import Icon from '../Icon/Icon'
|
||||||
|
import { NavigationController } from '@/Controllers/Navigation/NavigationController'
|
||||||
|
import { observer } from 'mobx-react-lite'
|
||||||
|
import { SystemViewId, isSmartView } from '@standardnotes/snjs'
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
notesController: NotesController
|
notesController: NotesController
|
||||||
|
navigationController: NavigationController
|
||||||
}
|
}
|
||||||
|
|
||||||
const MobileMultiSelectionToolbar = ({ notesController }: Props) => {
|
const MobileMultiSelectionToolbar = ({ notesController, navigationController }: Props) => {
|
||||||
const { selectedNotes } = notesController
|
const { selectedNotes } = notesController
|
||||||
|
const { selected } = navigationController
|
||||||
|
|
||||||
const archived = selectedNotes.some((note) => note.archived)
|
const archived = selectedNotes.some((note) => note.archived)
|
||||||
|
|
||||||
@@ -26,7 +31,16 @@ const MobileMultiSelectionToolbar = ({ notesController }: Props) => {
|
|||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
className="flex-grow px-2 py-3 active:bg-passive-3"
|
className="flex-grow px-2 py-3 active:bg-passive-3"
|
||||||
onClick={() => notesController.setTrashSelectedNotes(true).catch(console.error)}
|
onClick={() => {
|
||||||
|
const isInTrashView = selected && isSmartView(selected) && selected.uuid === SystemViewId.TrashedNotes
|
||||||
|
const allSelectedNotesAreTrashed = selectedNotes.every((note) => note.trashed)
|
||||||
|
const shouldDeletePermanently = isInTrashView || allSelectedNotesAreTrashed
|
||||||
|
if (shouldDeletePermanently) {
|
||||||
|
notesController.deleteNotesPermanently().catch(console.error)
|
||||||
|
} else {
|
||||||
|
notesController.setTrashSelectedNotes(true).catch(console.error)
|
||||||
|
}
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<Icon type="trash" className="mx-auto text-info" size="large" />
|
<Icon type="trash" className="mx-auto text-info" size="large" />
|
||||||
</button>
|
</button>
|
||||||
@@ -40,4 +54,4 @@ const MobileMultiSelectionToolbar = ({ notesController }: Props) => {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default MobileMultiSelectionToolbar
|
export default observer(MobileMultiSelectionToolbar)
|
||||||
|
|||||||
@@ -109,6 +109,7 @@ export const Strings = {
|
|||||||
protectingNoteWithoutProtectionSources:
|
protectingNoteWithoutProtectionSources:
|
||||||
'Access to this note will not be restricted until you set up a passcode or account.',
|
'Access to this note will not be restricted until you set up a passcode or account.',
|
||||||
trashItemsTitle: 'Move to Trash',
|
trashItemsTitle: 'Move to Trash',
|
||||||
|
deleteItemsPermanentlyTitle: 'Delete Permanently',
|
||||||
trashNotesText: 'Are you sure you want to move these notes to the trash?',
|
trashNotesText: 'Are you sure you want to move these notes to the trash?',
|
||||||
trashFilesText: 'Are you sure you want to move these files to the trash?',
|
trashFilesText: 'Are you sure you want to move these files to the trash?',
|
||||||
enterPasscode: 'Please enter a passcode.',
|
enterPasscode: 'Please enter a passcode.',
|
||||||
|
|||||||
@@ -213,7 +213,7 @@ export class NotesController
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
const title = Strings.trashItemsTitle
|
const title = permanently ? Strings.deleteItemsPermanentlyTitle : Strings.trashItemsTitle
|
||||||
let noteTitle = undefined
|
let noteTitle = undefined
|
||||||
if (this.selectedNotesCount === 1) {
|
if (this.selectedNotesCount === 1) {
|
||||||
const selectedNote = this.getSelectedNotesList()[0]
|
const selectedNote = this.getSelectedNotesList()[0]
|
||||||
|
|||||||
Reference in New Issue
Block a user