Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/actions/__tests__/sponsor-forms-actions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ describe("Sponsor Forms Actions", () => {
expect.anything(),
expect.anything(),
{
hideArchived: false,
showArchived: false,
order: "id",
orderDir: 1,
currentPage: 2,
Expand Down Expand Up @@ -246,7 +246,7 @@ describe("Sponsor Forms Actions", () => {
perPage: 25,
order: "name",
orderDir: -1,
hideArchived: true
showArchived: false
}
});

Expand Down Expand Up @@ -277,7 +277,7 @@ describe("Sponsor Forms Actions", () => {
`${window.PURCHASES_API_URL}/api/v1/summits/99/show-forms`,
expect.any(Function),
{
hideArchived: true,
showArchived: false,
order: "name",
orderDir: -1,
currentPage: 3,
Expand Down
6 changes: 3 additions & 3 deletions src/actions/form-template-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export const getFormTemplates =
perPage = DEFAULT_PER_PAGE,
order = "id",
orderDir = DEFAULT_ORDER_DIR,
hideArchived = false
showArchived = false
) =>
async (dispatch) => {
const accessToken = await getAccessTokenSafely();
Expand All @@ -97,7 +97,7 @@ export const getFormTemplates =
access_token: accessToken
};

if (hideArchived) filter.push("is_archived==0");
filter.push(`is_archived==${showArchived ? 1 : 0}`);

if (filter.length > 0) {
params["filter[]"] = filter;
Expand All @@ -114,7 +114,7 @@ export const getFormTemplates =
createAction(RECEIVE_FORM_TEMPLATES),
`${window.INVENTORY_API_BASE_URL}/api/v1/form-templates`,
authErrorHandler,
{ order, orderDir, page, perPage, term, hideArchived }
{ order, orderDir, page, perPage, term, showArchived }
)(params)(dispatch).then(() => {
dispatch(stopLoading());
});
Expand Down
8 changes: 4 additions & 4 deletions src/actions/form-template-item-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export const getFormTemplateItems =
perPage = DEFAULT_PER_PAGE,
order = "id",
orderDir = DEFAULT_ORDER_DIR,
hideArchived = false
showArchived = false
) =>
async (dispatch) => {
const accessToken = await getAccessTokenSafely();
Expand All @@ -97,12 +97,12 @@ export const getFormTemplateItems =
access_token: accessToken
};

filter.push(`is_archived==${showArchived ? 1 : 0}`);

if (filter.length > 0) {
params["filter[]"] = filter;
}

if (hideArchived) filter.push("is_archived==0");

// order
if (order != null && orderDir != null) {
const orderDirSign = orderDir === 1 ? "" : "-";
Expand All @@ -114,7 +114,7 @@ export const getFormTemplateItems =
createAction(RECEIVE_FORM_TEMPLATE_ITEMS),
`${window.INVENTORY_API_BASE_URL}/api/v1/form-templates/${formTemplateId}/items`,
snackbarErrorHandler,
{ order, orderDir, page, term, hideArchived }
{ order, orderDir, page, term, showArchived }
)(params)(dispatch).then(() => {
dispatch(stopLoading());
});
Expand Down
6 changes: 3 additions & 3 deletions src/actions/inventory-item-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export const getInventoryItems =
perPage = DEFAULT_PER_PAGE,
order = "id",
orderDir = DEFAULT_ORDER_DIR,
hideArchived = false
showArchived = false
) =>
async (dispatch) => {
const accessToken = await getAccessTokenSafely();
Expand All @@ -114,7 +114,7 @@ export const getInventoryItems =
filter.push(`name=@${escapedTerm},code=@${escapedTerm}`);
}

if (hideArchived) filter.push("is_archived==0");
filter.push(`is_archived==${showArchived ? 1 : 0}`);

const params = {
page,
Expand All @@ -140,7 +140,7 @@ export const getInventoryItems =
createAction(RECEIVE_INVENTORY_ITEMS),
`${window.INVENTORY_API_BASE_URL}/api/v1/inventory-items`,
authErrorHandler,
{ order, orderDir, page, perPage, term, hideArchived }
{ order, orderDir, page, perPage, term, showArchived }
)(params)(dispatch).then(() => {
dispatch(stopLoading());
});
Expand Down
6 changes: 3 additions & 3 deletions src/actions/page-template-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export const getPageTemplates =
perPage = DEFAULT_PER_PAGE,
order = "id",
orderDir = DEFAULT_ORDER_DIR,
hideArchived = false
showArchived = false
) =>
async (dispatch) => {
const accessToken = await getAccessTokenSafely();
Expand All @@ -78,7 +78,7 @@ export const getPageTemplates =
access_token: accessToken
};

if (hideArchived) filter.push("is_archived==0");
filter.push(`is_archived==${showArchived ? 1 : 0}`);

if (filter.length > 0) {
params["filter[]"] = filter;
Expand All @@ -95,7 +95,7 @@ export const getPageTemplates =
createAction(RECEIVE_PAGE_TEMPLATES),
`${window.SPONSOR_PAGES_API_URL}/api/v1/page-templates`,
authErrorHandler,
{ order, orderDir, page, perPage, term, hideArchived }
{ order, orderDir, page, perPage, term, showArchived }
)(params)(dispatch).then(() => {
dispatch(stopLoading());
});
Expand Down
6 changes: 3 additions & 3 deletions src/actions/show-pages-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export const getShowPages =
perPage = DEFAULT_PER_PAGE,
order = "id",
orderDir = DEFAULT_ORDER_DIR,
hideArchived = false,
showArchived = false,
sponsorshipTypesId = []
) =>
async (dispatch, getState) => {
Expand All @@ -75,7 +75,7 @@ export const getShowPages =
expand: "sponsorship_types,modules"
};

if (hideArchived) filter.push("is_archived==0");
filter.push(`is_archived==${showArchived ? 1 : 0}`);

if (sponsorshipTypesId?.length > 0) {
const formattedSponsorships = sponsorshipTypesId.join("&&");
Expand All @@ -98,7 +98,7 @@ export const getShowPages =
createAction(RECEIVE_SHOW_PAGES),
`${window.SPONSOR_PAGES_API_URL}/api/v1/summits/${currentSummit.id}/show-pages`,
authErrorHandler,
{ order, orderDir, page, perPage, term, hideArchived, summitTZ }
{ order, orderDir, page, perPage, term, showArchived, summitTZ }
)(params)(dispatch).then(() => {
dispatch(stopLoading());
});
Expand Down
38 changes: 19 additions & 19 deletions src/actions/sponsor-forms-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export const getSponsorForms =
perPage = DEFAULT_PER_PAGE,
order = "id",
orderDir = DEFAULT_ORDER_DIR,
hideArchived = false,
showArchived = false,
sponsorshipTypesId = []
) =>
async (dispatch, getState) => {
Expand All @@ -139,7 +139,7 @@ export const getSponsorForms =
expand: "sponsorship_types"
};

if (hideArchived) filter.push("is_archived==0");
filter.push(`is_archived==${showArchived ? 1 : 0}`);

if (sponsorshipTypesId?.length > 0) {
const formattedSponsorships = sponsorshipTypesId.join("&&");
Expand All @@ -162,7 +162,7 @@ export const getSponsorForms =
createAction(RECEIVE_SPONSOR_FORMS),
`${window.PURCHASES_API_URL}/api/v1/summits/${currentSummit.id}/show-forms`,
authErrorHandler,
{ order, orderDir, currentPage, perPage, term, hideArchived }
{ order, orderDir, currentPage, perPage, term, showArchived }
)(params)(dispatch).then(() => {
dispatch(stopLoading());
});
Expand Down Expand Up @@ -263,7 +263,7 @@ export const getGlobalTemplates =
perPage = DEFAULT_PER_PAGE,
order = "id",
orderDir = DEFAULT_ORDER_DIR,
hideArchived = false
showArchived = false
) =>
async (dispatch) => {
const accessToken = await getAccessTokenSafely();
Expand All @@ -284,7 +284,7 @@ export const getGlobalTemplates =
access_token: accessToken
};

if (hideArchived) filter.push("is_archived==0");
filter.push(`is_archived==${showArchived ? 1 : 0}`);

if (filter.length > 0) {
params["filter[]"] = filter;
Expand Down Expand Up @@ -461,7 +461,7 @@ export const updateFormTemplateTiers =
const { currentSummitState, sponsorFormsListState } = getState();
const accessToken = await getAccessTokenSafely();
const { currentSummit } = currentSummitState;
const { term, currentPage, perPage, order, orderDir, hideArchived } =
const { term, currentPage, perPage, order, orderDir, showArchived } =
sponsorFormsListState;

dispatch(startLoading());
Expand Down Expand Up @@ -492,7 +492,7 @@ export const updateFormTemplateTiers =
perPage,
order,
orderDir,
hideArchived
showArchived
)
);
})
Expand Down Expand Up @@ -534,7 +534,7 @@ export const getSponsorManagedForms =
perPage = DEFAULT_PER_PAGE,
order = "id",
orderDir = DEFAULT_ORDER_DIR,
hideArchived = false
showArchived = false
) =>
async (dispatch, getState) => {
const { currentSummitState, currentSponsorState } = getState();
Expand Down Expand Up @@ -562,7 +562,7 @@ export const getSponsorManagedForms =
access_token: accessToken
};

if (hideArchived) filter.push("is_archived==0");
filter.push(`is_archived==${showArchived ? 1 : 0}`);

if (filter.length > 0) {
params["filter[]"] = filter;
Expand All @@ -579,7 +579,7 @@ export const getSponsorManagedForms =
createAction(RECEIVE_SPONSOR_MANAGED_FORMS),
`${window.PURCHASES_API_URL}/api/v1/summits/${currentSummit.id}/sponsors/${sponsorId}/managed-forms`,
authErrorHandler,
{ order, orderDir, page, term, summitTZ, hideArchived }
{ order, orderDir, page, term, summitTZ, showArchived }
)(params)(dispatch).then(() => {
dispatch(stopLoading());
});
Expand Down Expand Up @@ -640,7 +640,7 @@ export const getSponsorCustomizedForms =
perPage = DEFAULT_PER_PAGE,
order = "id",
orderDir = DEFAULT_ORDER_DIR,
hideArchived = false
showArchived = false
) =>
async (dispatch, getState) => {
const { currentSummitState, currentSponsorState } = getState();
Expand Down Expand Up @@ -668,7 +668,7 @@ export const getSponsorCustomizedForms =
access_token: accessToken
};

if (hideArchived) filter.push("is_archived==0");
filter.push(`is_archived==${showArchived ? 1 : 0}`);

if (filter.length > 0) {
params["filter[]"] = filter;
Expand All @@ -685,7 +685,7 @@ export const getSponsorCustomizedForms =
createAction(RECEIVE_SPONSOR_CUSTOMIZED_FORMS),
`${window.PURCHASES_API_URL}/api/v1/summits/${currentSummit.id}/sponsors/${sponsorId}/sponsor-forms`,
authErrorHandler,
{ order, orderDir, page, term, summitTZ, hideArchived }
{ order, orderDir, page, term, summitTZ, showArchived }
)(params)(dispatch).then(() => {
dispatch(stopLoading());
});
Expand Down Expand Up @@ -727,7 +727,7 @@ export const getSponsorCustomizedFormItems =
perPage = DEFAULT_PER_PAGE,
order = "id",
orderDir = DEFAULT_ORDER_DIR,
hideArchived = false
showArchived = false
) =>
async (dispatch, getState) => {
const { currentSummitState, currentSponsorState } = getState();
Expand All @@ -751,7 +751,7 @@ export const getSponsorCustomizedFormItems =
access_token: accessToken
};

if (hideArchived) filter.push("is_archived==0");
filter.push(`is_archived==${showArchived ? 1 : 0}`);

if (filter.length > 0) {
params["filter[]"] = filter;
Expand All @@ -768,7 +768,7 @@ export const getSponsorCustomizedFormItems =
createAction(RECEIVE_SPONSOR_CUSTOMIZED_FORM_ITEMS),
`${window.PURCHASES_API_URL}/api/v1/summits/${currentSummit.id}/sponsors/${sponsorId}/sponsor-forms/${formId}/items`,
authErrorHandler,
{ term, order, orderDir, page, perPage, hideArchived }
{ term, order, orderDir, page, perPage, showArchived }
)(params)(dispatch).then(() => {
dispatch(stopLoading());
});
Expand Down Expand Up @@ -1009,7 +1009,7 @@ export const getSponsorFormItems =
perPage = DEFAULT_PER_PAGE,
order = "id",
orderDir = DEFAULT_ORDER_DIR,
hideArchived = false
showArchived = false
) =>
async (dispatch, getState) => {
const { currentSummitState } = getState();
Expand All @@ -1028,7 +1028,7 @@ export const getSponsorFormItems =
access_token: accessToken
};

if (hideArchived) filter.push("is_archived==0");
filter.push(`is_archived==${showArchived ? 1 : 0}`);

if (filter.length > 0) {
params["filter[]"] = filter;
Expand All @@ -1045,7 +1045,7 @@ export const getSponsorFormItems =
createAction(RECEIVE_SPONSOR_FORM_ITEMS),
`${window.PURCHASES_API_URL}/api/v1/summits/${currentSummit.id}/show-forms/${formId}/items`,
authErrorHandler,
{ order, orderDir, page, hideArchived }
{ order, orderDir, page, showArchived }
)(params)(dispatch).then(() => {
dispatch(stopLoading());
});
Expand Down
12 changes: 6 additions & 6 deletions src/actions/sponsor-pages-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export const getSponsorManagedPages =
perPage = DEFAULT_PER_PAGE,
order = "id",
orderDir = DEFAULT_ORDER_DIR,
hideArchived = false
showArchived = false
) =>
async (dispatch, getState) => {
const { currentSummitState, currentSponsorState } = getState();
Expand All @@ -140,7 +140,7 @@ export const getSponsorManagedPages =
access_token: accessToken
};

if (hideArchived) filter.push("is_archived==0");
filter.push(`is_archived==${showArchived ? 1 : 0}`);

if (filter.length > 0) {
params["filter[]"] = filter;
Expand All @@ -157,7 +157,7 @@ export const getSponsorManagedPages =
createAction(RECEIVE_SPONSOR_MANAGED_PAGES),
`${window.SPONSOR_PAGES_API_URL}/api/v1/summits/${currentSummit.id}/sponsors/${sponsorId}/managed-pages`,
snackbarErrorHandler,
{ order, orderDir, page, perPage, term, hideArchived, summitTZ }
{ order, orderDir, page, perPage, term, showArchived, summitTZ }
)(params)(dispatch).finally(() => {
dispatch(stopLoading());
});
Expand Down Expand Up @@ -348,7 +348,7 @@ export const getSponsorCustomizedPages =
perPage = DEFAULT_PER_PAGE,
order = "id",
orderDir = DEFAULT_ORDER_DIR,
hideArchived = false
showArchived = false
) =>
async (dispatch, getState) => {
const { currentSummitState, currentSponsorState } = getState();
Expand Down Expand Up @@ -376,7 +376,7 @@ export const getSponsorCustomizedPages =
access_token: accessToken
};

if (hideArchived) filter.push("is_archived==0");
filter.push(`is_archived==${showArchived ? 1 : 0}`);

if (filter.length > 0) {
params["filter[]"] = filter;
Expand All @@ -393,7 +393,7 @@ export const getSponsorCustomizedPages =
createAction(RECEIVE_SPONSOR_CUSTOMIZED_PAGES),
`${window.SPONSOR_PAGES_API_URL}/api/v1/summits/${currentSummit.id}/sponsors/${sponsorId}/sponsor-pages`,
snackbarErrorHandler,
{ order, orderDir, page, perPage, term, hideArchived, summitTZ }
{ order, orderDir, page, perPage, term, showArchived, summitTZ }
)(params)(dispatch).finally(() => {
dispatch(stopLoading());
});
Expand Down
Loading
Loading