Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

fix delete and restore note

ammarahm-edd7942bcf465e
diff --git a/apps/mobile/src/components/ActionSheetComponent/index.js b/apps/mobile/src/components/ActionSheetComponent/index.js
index 210420703..49d5c054d 100644
--- a/apps/mobile/src/components/ActionSheetComponent/index.js
+++ b/apps/mobile/src/components/ActionSheetComponent/index.js
@@ -137,6 +137,9 @@ export const ActionSheetComponent = ({
if (!nodispatch) {
dispatch({type: type});
+ if (type === "note") {
+ eSendEvent(refreshNotesPage)
+ }
dispatch({type: Actions.FAVORITES});
}
setNote({...toAdd});
@@ -234,8 +237,11 @@ export const ActionSheetComponent = ({
name: 'Restore',
icon: 'delete-restore',
func: async () => {
+ await db.trash.restore(note.id);
dispatch({type: Actions.TRASH});
- localRefresh(note.type);
+ dispatch({type: note.itemType});
+ dispatch({type: Actions.FAVORITES});
+ eSendEvent(refreshNotesPage)
ToastEvent.show(
item.type === 'note' ? 'Note restored' : 'Notebook restored',
'success',
diff --git a/apps/mobile/src/utils/functions.js b/apps/mobile/src/utils/functions.js
index 2cf80af64..08fc9dcd0 100644
--- a/apps/mobile/src/utils/functions.js
+++ b/apps/mobile/src/utils/functions.js
@@ -35,7 +35,7 @@ export async function deleteItems(item) {
if (history.selectedItemsList[0].type !== 'topic') {
ToastEvent.show(
message,
- 'success',
+ 'error',
'global',
6000,
async () => {
@@ -53,6 +53,7 @@ export async function deleteItems(item) {
'Undo',
);
}
+ updateEvent({type: Actions.TRASH});
updateEvent({type: Actions.CLEAR_SELECTION});
updateEvent({type: Actions.SELECTION_MODE, enabled: false});
}