@overmap-ai/core 1.0.28 → 1.0.29-org-switcher-and-bug-fixes.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2458,6 +2458,11 @@ const selectActiveOrganizationId = (state) => {
2458
2458
  const selectOrganizations = (state) => {
2459
2459
  return Object.values(state.organizationReducer.organizations);
2460
2460
  };
2461
+ const selectOrganizationsWithAccess = (state) => {
2462
+ return Object.values(state.organizationReducer.organizations).filter(
2463
+ (organization) => organization.has_access
2464
+ );
2465
+ };
2461
2466
  const selectActiveOrganization = (state) => {
2462
2467
  const id = selectActiveOrganizationId(state);
2463
2468
  if (!id) {
@@ -4872,13 +4877,16 @@ class MainService extends BaseApiService {
4872
4877
  }
4873
4878
  }
4874
4879
  store.dispatch(setCurrentUser(data.user));
4880
+ store.dispatch(addUsers(data.project_owners));
4875
4881
  const organizationsData = data.organizations;
4876
4882
  store.dispatch(setOrganizations(organizationsData));
4877
4883
  const activeOrganizationId = store.getState().organizationReducer.activeOrganizationId;
4878
- const firstOrg = organizationsData[0];
4884
+ const firstOrg = organizationsData.find((organization) => organization.has_access);
4879
4885
  const currProjObj = projects.find((project) => project.id === currentProjectId);
4880
4886
  const isOrgProject = !!(currProjObj == null ? void 0 : currProjObj.owner_organization);
4881
- const userIsInProjectOrg = isOrgProject && organizationsData.some((organization) => organization.id === currProjObj.owner_organization);
4887
+ const userIsInProjectOrg = isOrgProject && organizationsData.some(
4888
+ (organization) => organization.has_access && organization.id === currProjObj.owner_organization
4889
+ );
4882
4890
  let currentOrgId = null;
4883
4891
  if (activeOrganizationId) {
4884
4892
  currentOrgId = activeOrganizationId;
@@ -6292,6 +6300,7 @@ export {
6292
6300
  selectOrganizationUsersAsMapping,
6293
6301
  selectOrganizationUsersIds,
6294
6302
  selectOrganizations,
6303
+ selectOrganizationsWithAccess,
6295
6304
  selectPermittedWorkspaceIds,
6296
6305
  selectPhotoAttachmentsOfIssue,
6297
6306
  selectProjectAccess,