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

Production deploy #3791

Merged
merged 7 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ describe("sendAgentAndPayeeConfirmationEmail", () => {
helpOpeningHours: "9-5",
helpPhone: "123",
serviceName: "Some Flow",
sessionId: "mockSessionId",
},
};
await sendAgentAndPayeeConfirmationEmail("mockSessionId");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ import { formatRawProjectTypes } from "@opensystemslab/planx-core";
import { gql } from "graphql-request";
import { $api } from "../../../../client/index.js";
import { sendEmail } from "../../../../lib/notify/index.js";
import type { AgentAndPayeeSubmissionNotifyConfig } from "../../../../types.js";
import type {
AgentAndPayeeSubmissionNotifyConfig,
AgentAndPayeeSubmissionNotifyPersonalisation,
} from "../../../../types.js";

export async function sendAgentAndPayeeConfirmationEmail(sessionId: string) {
const { personalisation, applicantEmail, payeeEmail, projectTypes } =
Expand All @@ -22,16 +25,10 @@ export async function sendAgentAndPayeeConfirmationEmail(sessionId: string) {
}

type PayeeAndAgentEmailData = {
personalisation: {
emailReplyToId: string;
helpEmail: string;
helpOpeningHours: string;
helpPhone: string;
serviceName: string;
payeeName: string;
address: string;
applicantName: string;
};
personalisation: Omit<
AgentAndPayeeSubmissionNotifyPersonalisation,
"projectType"
>;
applicantEmail: string;
payeeEmail: string;
projectTypes: string[];
Expand All @@ -45,6 +42,7 @@ async function getDataForPayeeAndAgentEmails(
lowcal_sessions(where: { id: { _eq: $sessionId } }, limit: 1) {
email
flow {
name
slug
team {
notifyPersonalisation: team_settings {
Expand Down Expand Up @@ -109,6 +107,7 @@ async function getDataForPayeeAndAgentEmails(
payeeName,
address,
applicantName,
sessionId,
},
applicantEmail,
payeeEmail,
Expand Down
2 changes: 2 additions & 0 deletions api.planx.uk/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ export interface AgentAndPayeeSubmissionNotifyPersonalisation
payeeName: string;
address: string;
projectType: string;
serviceName: string;
sessionId: string;
}

export interface AgentAndPayeeSubmissionNotifyConfig {
Expand Down
1 change: 1 addition & 0 deletions e2e/tests/ui-driven/src/refresh-page.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ test.describe("Refresh page", () => {

const teamSlugInHeader = page.getByRole("link", {
name: context.team.slug,
exact: true,
});
await expect(teamSlugInHeader).toBeVisible();

Expand Down
7 changes: 7 additions & 0 deletions editor.planx.uk/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ if (!window.customElements.get("my-map")) {
window.customElements.define("my-map", MyMap);
}

// Refresh window if user hits "Failed to fetch dynamically imported module" due to renamed assets following re-build after deploy
// Docs: https://vite.dev/guide/build#load-error-handling
window.addEventListener("vite:preloadError", (event) => {
event.preventDefault();
window.location.reload();
});

const hasJWT = (): boolean | void => {
// This cookie indicates the presence of the secure httpOnly "jwt" cookie
const authCookie = getCookie("auth");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,17 +194,19 @@ export const MembersTable = ({
</StyledTableRow>
))}
{showAddMemberButton && (
<TableRow>
<TableCell colSpan={5}>
<AddButton
onClick={() => {
addUser();
}}
>
Add a new editor
</AddButton>
</TableCell>
</TableRow>
<Permission.IsPlatformAdmin>
<TableRow>
<TableCell colSpan={5}>
<AddButton
onClick={() => {
addUser();
}}
>
Add a new editor
</AddButton>
</TableCell>
</TableRow>
</Permission.IsPlatformAdmin>
)}
</TableBody>
</Table>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ describe("when a user is not a platform admin", () => {
useStore.setState({
teamMembers: mockTeamMembersData,
user: mockPlainUser,
teamSlug: "templates",
teamSlug: "trumptonshire",
});
});

Expand Down