Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync staging with develop #528

Merged
merged 5 commits into from
Jan 9, 2025
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
12 changes: 11 additions & 1 deletion app/client/src/routes/helpdesk.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,12 @@ export function Helpdesk() {
results: SubmissionAction[];
}>({ fetched: false, results: [] });

useEffect(() => {
if (helpdeskAccess === "failure") {
navigate("/", { replace: true });
}
}, [navigate, helpdeskAccess]);

useEffect(() => {
queryClient.resetQueries({ queryKey: ["helpdesk/submission"] });
}, [queryClient]);
Expand Down Expand Up @@ -456,7 +462,11 @@ export function Helpdesk() {
}

if (helpdeskAccess === "failure") {
navigate("/", { replace: true });
/**
* NOTE: this is just included for completeness, as before this is rendered,
* the user will have been redirected to their dashboard via the useEffect()
*/
return null;
}

return (
Expand Down
6 changes: 2 additions & 4 deletions app/server/app/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,8 @@ function ensureHelpdesk(req, res, next) {
const userRoles = memberof?.split(",") || [];

if (!userRoles.includes("csb_admin") && !userRoles.includes("csb_helpdesk")) {
if (!req.originalUrl.includes("/helpdesk-access")) {
const logMessage = `User with email ${mail} attempted to perform an admin/helpdesk action without correct privileges.`;
log({ level: "error", message: logMessage, req });
}
const logMessage = `User with email ${mail} attempted to perform an admin/helpdesk action without correct privileges.`;
log({ level: "error", message: logMessage, req });

const errorStatus = 401;
const errorMessage = `Unauthorized.`;
Expand Down
6 changes: 3 additions & 3 deletions app/server/app/utilities/bap.js
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ const { submissionPeriodOpen } = require("../config/formio");
* CSB_Manufacturer__c: string
* CSB_Manufacturer_if_Other__c: string | null
* CSB_Annual_Fuel_Consumption__c: number
* Annual_Mileage__c: number
* Old_Bus_Average_Annual_Mileage__c: number
* Old_Bus_Estimated_Remaining_Life__c: number
* Old_Bus_Annual_Idling_Hours__c: number
* New_Bus_Infra_Rebate_Requested__c: number
Expand Down Expand Up @@ -1465,7 +1465,7 @@ async function queryBapFor2024PRFData(req, frfReviewItemId) {
// CSB_Manufacturer__c,
// CSB_Manufacturer_if_Other__c,
// CSB_Annual_Fuel_Consumption__c,
// Annual_Mileage__c,
// Old_Bus_Average_Annual_Mileage__c,
// Old_Bus_Estimated_Remaining_Life__c,
// Old_Bus_Annual_Idling_Hours__c,
// New_Bus_Infra_Rebate_Requested__c,
Expand Down Expand Up @@ -1501,7 +1501,7 @@ async function queryBapFor2024PRFData(req, frfReviewItemId) {
CSB_Manufacturer__c: 1,
CSB_Manufacturer_if_Other__c: 1,
CSB_Annual_Fuel_Consumption__c: 1,
Annual_Mileage__c: 1,
Old_Bus_Average_Annual_Mileage__c: 1,
Old_Bus_Estimated_Remaining_Life__c: 1,
Old_Bus_Annual_Idling_Hours__c: 1,
New_Bus_Infra_Rebate_Requested__c: 1,
Expand Down
4 changes: 2 additions & 2 deletions app/server/app/utilities/formio.js
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ function fetchDataForPRFSubmission({ rebateYear, req, res }) {
CSB_Manufacturer__c,
CSB_Manufacturer_if_Other__c,
CSB_Annual_Fuel_Consumption__c,
Annual_Mileage__c,
Old_Bus_Average_Annual_Mileage__c,
Old_Bus_Estimated_Remaining_Life__c,
Old_Bus_Annual_Idling_Hours__c,
New_Bus_Infra_Rebate_Requested__c,
Expand Down Expand Up @@ -661,7 +661,7 @@ function fetchDataForPRFSubmission({ rebateYear, req, res }) {
bus_existing_manufacturer: CSB_Manufacturer__c,
bus_existing_manufacturer_other: CSB_Manufacturer_if_Other__c,
bus_existing_annual_fuel_consumption: CSB_Annual_Fuel_Consumption__c, // prettier-ignore
bus_existing_annual_mileage: Annual_Mileage__c,
bus_existing_annual_mileage: Old_Bus_Average_Annual_Mileage__c,
bus_existing_remaining_life: Old_Bus_Estimated_Remaining_Life__c,
bus_existing_idling_hours: Old_Bus_Annual_Idling_Hours__c,
bus_new_owner: {
Expand Down
Loading