A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
mobile: fix invalid tags linked to note from share menu
Ammar Ahmedfb21fef82f41
diff --git a/apps/mobile/app/utils/note-bundle.js b/apps/mobile/app/utils/note-bundle.jsindex 1c3582db8..a8fbaa37a 100644--- a/apps/mobile/app/utils/note-bundle.js+++ b/apps/mobile/app/utils/note-bundle.js@@ -84,16 +84,18 @@ async function createNotes(bundle) {if (bundle.tags) {for (const tagId of bundle.tags) {- await db.relations.add(- {- type: "tag",- id: tagId- },- {- id: id,- type: "note"- }- );+ if (await db.tags.exists(tagId)) {+ await db.relations.add(+ {+ type: "tag",+ id: tagId+ },+ {+ id: id,+ type: "note"+ }+ );+ }}}const compress = bundle.compress;diff --git a/apps/mobile/share/add-tags.jsx b/apps/mobile/share/add-tags.jsxindex 84f4bc695..655a04d26 100644--- a/apps/mobile/share/add-tags.jsx+++ b/apps/mobile/share/add-tags.jsx@@ -27,7 +27,6 @@ import { defaultBorderRadius } from "../app/utils/size";export const AddTags = ({ onPress }) => {const { colors } = useThemeColors();const tagIds = useShareStore((state) => state.selectedTags);-return (<TouchableOpacityonPress={onPress}@@ -123,7 +122,7 @@ const TagItem = ({ tagId }) => {}}onPress={() => {const index = tagIds.indexOf(tagId);- const selectedTags = [...tagId];+ const selectedTags = tagIds.slice();selectedTags.splice(index, 1);useShareStore.getState().setSelectedTags(selectedTags);}}