diff --git a/android/app/build.gradle b/android/app/build.gradle index 2048b63ec2..a3649da60b 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -118,7 +118,7 @@ android { applicationId "com.missionhub" minSdkVersion 16 targetSdkVersion 26 - versionName "4.2.6" + versionName "4.2.7" versionCode grgit.log(includes:['HEAD']).size() + 363 ndk { abiFilters "armeabi-v7a", "x86" diff --git a/src/actions/__tests__/impact.js b/src/actions/__tests__/impact.js index 1f896e853c..dadef52b66 100644 --- a/src/actions/__tests__/impact.js +++ b/src/actions/__tests__/impact.js @@ -34,6 +34,25 @@ describe('refreshImpact', () => { }); expect(store.getActions()).toEqual([apiResponse, apiResponse]); }); + + it('should get my impact and global impact with org', async () => { + const orgId = '123'; + await store.dispatch(refreshImpact(orgId)); + + expect(callApi).toHaveBeenCalledWith(REQUESTS.GET_IMPACT_SUMMARY, { + person_id: 'me', + organization_id: undefined, + }); + expect(callApi).toHaveBeenCalledWith(REQUESTS.GET_IMPACT_SUMMARY, { + person_id: undefined, + organization_id: orgId, + }); + expect(callApi).toHaveBeenCalledWith(REQUESTS.GET_IMPACT_SUMMARY, { + person_id: undefined, + organization_id: undefined, + }); + expect(store.getActions()).toEqual([apiResponse, apiResponse, apiResponse]); + }); }); describe('getImpactSummary', () => { diff --git a/src/actions/__tests__/interactions.js b/src/actions/__tests__/interactions.js index 6b5e8f0989..e32bd381a2 100644 --- a/src/actions/__tests__/interactions.js +++ b/src/actions/__tests__/interactions.js @@ -65,7 +65,6 @@ describe('add comment', () => { ACTIONS.INTERACTION.name, { [interaction.tracking]: null }, ); - mockFnWithParams(impact, 'refreshImpact', refreshImpactResult); reloadGroupCelebrateFeed.mockReturnValue(celebrationFeedResult); }); @@ -98,6 +97,8 @@ describe('add comment', () => { }; it('should add a new comment', async () => { + mockFnWithParams(impact, 'refreshImpact', refreshImpactResult, undefined); + mockApi(action, REQUESTS.ADD_NEW_INTERACTION, {}, expectedBody); await store.dispatch(addNewInteraction(personId, interaction, comment)); @@ -147,6 +148,7 @@ describe('add comment', () => { }; it('should add a new comment', async () => { + mockFnWithParams(impact, 'refreshImpact', refreshImpactResult, orgId); mockApi(action, REQUESTS.ADD_NEW_INTERACTION, {}, expectedBody); await store.dispatch( diff --git a/src/actions/__tests__/steps.js b/src/actions/__tests__/steps.js index 80089cab6e..a8f5e594ea 100644 --- a/src/actions/__tests__/steps.js +++ b/src/actions/__tests__/steps.js @@ -313,7 +313,7 @@ describe('complete challenge', () => { }); it('completes step for personal ministry', async () => { - const noOrgStep = { ...step, organization: null }; + const noOrgStep = { ...step, organization: undefined }; await store.dispatch(completeStep(noOrgStep, screen)); expect(callApi).toHaveBeenCalledWith( REQUESTS.GET_MY_CHALLENGES, diff --git a/src/actions/impact.js b/src/actions/impact.js index 26a1ccc575..46ad53df39 100644 --- a/src/actions/impact.js +++ b/src/actions/impact.js @@ -5,9 +5,12 @@ import { import callApi, { REQUESTS } from './api'; -export function refreshImpact() { +export function refreshImpact(orgId) { return dispatch => { dispatch(getImpactSummary('me')); + if (orgId) { + dispatch(getImpactSummary(undefined, orgId)); + } return dispatch(getImpactSummary()); }; } diff --git a/src/actions/interactions.js b/src/actions/interactions.js index 3066eb32a2..db77500cf0 100644 --- a/src/actions/interactions.js +++ b/src/actions/interactions.js @@ -68,7 +68,7 @@ export function addNewInteraction( }), ); dispatch(reloadJourney(personId, organizationId)); - dispatch(refreshImpact()); + dispatch(refreshImpact(organizationId)); dispatch(reloadGroupCelebrateFeed(organizationId)); return response; diff --git a/src/actions/selectStage.js b/src/actions/selectStage.js index af84f11ba7..927bb7c93d 100644 --- a/src/actions/selectStage.js +++ b/src/actions/selectStage.js @@ -38,7 +38,7 @@ export function updateUserStage(contactAssignmentId, stageId) { const personId = person && person.id; const orgId = organization && organization.id; - dispatch(refreshImpact()); + dispatch(refreshImpact(orgId)); dispatch(getPersonDetails(personId, orgId)); return response; }; @@ -87,7 +87,7 @@ export function selectPersonStage( callApi(REQUESTS.CREATE_CONTACT_ASSIGNMENT, {}, data), ); - dispatch(refreshImpact()); + dispatch(refreshImpact(orgId)); dispatch(getPersonDetails(personId, orgId)); return response; }; diff --git a/src/actions/steps.js b/src/actions/steps.js index b84592c256..8e04322f18 100644 --- a/src/actions/steps.js +++ b/src/actions/steps.js @@ -203,7 +203,7 @@ function challengeCompleteAction(step, screen) { const subsection = getAnalyticsSubsection(step.receiver.id, myId); dispatch({ type: COMPLETED_STEP_COUNT, userId: step.receiver.id }); - dispatch(refreshImpact()); + dispatch(refreshImpact(step.organization && step.organization.id)); dispatch( navigatePush(ADD_STEP_SCREEN, { trackingObj: buildTrackingObj(