1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-07-16 00:14:34 +02:00

Mobile: Resolves #10763: Support permanent note deletion on mobile (#10786)

This commit is contained in:
Henry Heino
2024-09-21 05:05:27 -07:00
committed by GitHub
parent 050a896c8b
commit 220f867814
9 changed files with 88 additions and 65 deletions

View File

@ -280,19 +280,32 @@ shared.initState = async function(comp: BaseNoteScreenComponent) {
comp.scheduleFocusUpdate();
}
const folder = Folder.byId(comp.props.folders, note.parent_id);
comp.setState({
lastSavedNote: { ...note },
note: note,
mode: mode,
folder: folder,
isLoading: false,
fromShare: !!comp.props.sharedData,
noteResources: await shared.attachedResources(note ? note.body : ''),
readOnly: itemIsReadOnlySync(ModelType.Note, ItemChange.SOURCE_UNSPECIFIED, note as ItemSlice, Setting.value('sync.userId'), BaseItem.syncShareCache),
});
const fromShare = !!comp.props.sharedData;
if (note) {
const folder = Folder.byId(comp.props.folders, note.parent_id);
comp.setState({
lastSavedNote: { ...note },
note: note,
mode: mode,
folder: folder,
isLoading: false,
fromShare: !!comp.props.sharedData,
noteResources: await shared.attachedResources(note ? note.body : ''),
readOnly: itemIsReadOnlySync(ModelType.Note, ItemChange.SOURCE_UNSPECIFIED, note as ItemSlice, Setting.value('sync.userId'), BaseItem.syncShareCache),
});
} else {
// Handle the case where a non-existent note is loaded. This can happen briefly after deleting a note.
comp.setState({
lastSavedNote: {},
note: {},
mode,
folder: null,
isLoading: true,
fromShare,
noteResources: [],
readOnly: true,
});
}
if (comp.props.sharedData) {
if (comp.props.sharedData.title) {
@ -315,7 +328,7 @@ shared.initState = async function(comp: BaseNoteScreenComponent) {
}
// eslint-disable-next-line require-atomic-updates
comp.lastLoadedNoteId_ = note.id;
comp.lastLoadedNoteId_ = note?.id;
};
shared.toggleIsTodo_onPress = function(comp: BaseNoteScreenComponent) {