Skip to content

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

prevent favorite items from being unfavorited.

ammarahm-ed0ccfdb7c9b8e
diff --git a/apps/mobile/src/components/SelectionHeader/index.js b/apps/mobile/src/components/SelectionHeader/index.js
index 327206d55..f204085c0 100644
--- a/apps/mobile/src/components/SelectionHeader/index.js
+++ b/apps/mobile/src/components/SelectionHeader/index.js
@@ -15,8 +15,7 @@ import {ACTIONS} from '../../provider/actions';
import {w, ToastEvent, db} from '../../utils/utils';
import {eSendEvent} from '../../services/eventManager';
import {eOpenMoveNoteDialog, eOpenSimpleDialog} from '../../services/events';
-
-import {TEMPLATE_DELETE} from '../DialogManager';
+import {TEMPLATE_DELETE} from '../DialogManager/templates';
export const AnimatedSafeAreaView = Animatable.createAnimatableComponent(
SafeAreaView,
@@ -128,10 +127,10 @@ export const SelectionHeader = ({navigation}) => {
let unFavCount = 0;
if (selectedItemsList.length > 0) {
selectedItemsList.forEach(async item => {
- if (item.favorite) {
+ if (!item.favorite) {
favCount += 1;
} else {
- unFavCount += 1;
+ return;
}
await db.notes.note(item.id).favorite();
dispatch({type: ACTIONS.NOTES});
@@ -143,10 +142,7 @@ export const SelectionHeader = ({navigation}) => {
dispatch({type: ACTIONS.CLEAR_SELECTION});
ToastEvent.show(
- favCount +
- ' notes added to favorites &' +
- unFavCount +
- 'removed',
+ favCount + ' notes added to favorites',
'success',
);
}