Skip to content

Commit

Permalink
Merge branch 'develop' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
reldredge71 committed Nov 8, 2018
2 parents 26febac + 67dc861 commit d760d54
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 8 deletions.
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
19 changes: 19 additions & 0 deletions src/actions/__tests__/impact.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
4 changes: 3 additions & 1 deletion src/actions/__tests__/interactions.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ describe('add comment', () => {
ACTIONS.INTERACTION.name,
{ [interaction.tracking]: null },
);
mockFnWithParams(impact, 'refreshImpact', refreshImpactResult);
reloadGroupCelebrateFeed.mockReturnValue(celebrationFeedResult);
});

Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion src/actions/__tests__/steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
5 changes: 4 additions & 1 deletion src/actions/impact.js
Original file line number Diff line number Diff line change
Expand Up @@ -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());
};
}
Expand Down
2 changes: 1 addition & 1 deletion src/actions/interactions.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export function addNewInteraction(
}),
);
dispatch(reloadJourney(personId, organizationId));
dispatch(refreshImpact());
dispatch(refreshImpact(organizationId));
dispatch(reloadGroupCelebrateFeed(organizationId));

return response;
Expand Down
4 changes: 2 additions & 2 deletions src/actions/selectStage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down Expand Up @@ -87,7 +87,7 @@ export function selectPersonStage(
callApi(REQUESTS.CREATE_CONTACT_ASSIGNMENT, {}, data),
);

dispatch(refreshImpact());
dispatch(refreshImpact(orgId));
dispatch(getPersonDetails(personId, orgId));
return response;
};
Expand Down
2 changes: 1 addition & 1 deletion src/actions/steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit d760d54

Please sign in to comment.