Skip to content

TagSpaces is an offline, open source, document manager with tagging support

Issues with tag collection (#1855)

Stanimirec7a24164a15
diff --git a/app/components/menus/TagGroupMenu.tsx b/app/components/menus/TagGroupMenu.tsx
index b5b42764c..c75645f11 100644
--- a/app/components/menus/TagGroupMenu.tsx
+++ b/app/components/menus/TagGroupMenu.tsx
@@ -35,6 +35,7 @@ import { connect } from 'react-redux';
import i18n from '-/services/i18n';
import { getMaxSearchResults } from '-/reducers/settings';
import { actions as LocationIndexActions } from '-/reducers/location-index';
+import { actions as AppActions } from '-/reducers/app';
import { TS } from '-/tagspaces.namespace';
import InfoIcon from '-/components/InfoIcon';
import { ProLabel } from '-/components/HelperComponents';
@@ -54,6 +55,7 @@ interface Props {
collectTagsFromLocation: (tagGroup: TS.TagGroup) => void;
handleCloseTagGroupMenu: () => void;
setSearchQuery: (searchQuery: TS.SearchQuery) => void;
+ tagLibraryChanged: () => void;
maxSearchResults: number;
}
@@ -65,6 +67,7 @@ function TagGroupMenu(props: Props) {
props.collectTagsFromLocation(props.selectedTagGroupEntry);
}
props.handleCloseTagGroupMenu();
+ props.tagLibraryChanged();
}
function moveTagGroupUp() {
@@ -183,7 +186,8 @@ function mapStateToProps(state) {
function mapDispatchToProps(dispatch) {
return bindActionCreators(
{
- setSearchQuery: LocationIndexActions.setSearchQuery
+ setSearchQuery: LocationIndexActions.setSearchQuery,
+ tagLibraryChanged: AppActions.tagLibraryChanged
},
dispatch
);
diff --git a/app/reducers/tagging-actions.ts b/app/reducers/tagging-actions.ts
index bf96730c8..3505d1374 100644
--- a/app/reducers/tagging-actions.ts
+++ b/app/reducers/tagging-actions.ts
@@ -156,7 +156,8 @@ const actions = {
created_date: new Date().getTime(),
modified_date: new Date().getTime()
};
- // dispatch(TagLibraryActions.mergeTagGroup(tagGroup));
+ mergeTagGroup(tagGroup, getTagLibrary());
+ dispatch(AppActions.tagLibraryChanged());
}
}
return Promise.all(promises).then(() => true);
@@ -541,7 +542,8 @@ const actions = {
created_date: new Date().getTime(),
modified_date: new Date().getTime()
};
- // dispatch(TagLibraryActions.mergeTagGroup(tagGroup));
+ mergeTagGroup(tagGroup, getTagLibrary());
+ dispatch(AppActions.tagLibraryChanged());
}
}
},
diff --git a/app/reducers/taglibrary.ts b/app/reducers/taglibrary.ts
index 2de915630..928857270 100644
--- a/app/reducers/taglibrary.ts
+++ b/app/reducers/taglibrary.ts
@@ -525,6 +525,9 @@ export const actions = {
type: types.ADD_TAGGROUP,
entry
}), */
+ /**
+ * @deprecated use /services/taglibrary-utils/mergeTagGroup instead
+ */
mergeTagGroup: (entry: TS.TagGroup) => (
dispatch: (actions: Object) => void,
getState: () => any
diff --git a/app/services/taglibrary-utils.ts b/app/services/taglibrary-utils.ts
index 9124c8bb1..80c342bf4 100644
--- a/app/services/taglibrary-utils.ts
+++ b/app/services/taglibrary-utils.ts
@@ -462,9 +462,9 @@ export function addTag(
export function mergeTagGroup(
entry: TS.TagGroup,
tagGroups: Array<TS.TagGroup>,
- locations: Array<TS.Location>
+ locations?: Array<TS.Location>
) {
- if (Pro && entry.locationId) {
+ if (Pro && entry.locationId && locations) {
const location: TS.Location = locations.find(
l => l.uuid === entry.locationId
);