diff --git a/__test__/features/Events/EventDisplay.test.tsx b/__test__/features/Events/EventDisplay.test.tsx index 1d315c2..f794acc 100644 --- a/__test__/features/Events/EventDisplay.test.tsx +++ b/__test__/features/Events/EventDisplay.test.tsx @@ -662,7 +662,78 @@ describe("Event Preview Display", () => { preloadedState.calendars.list["667037022b752d0026472254/cal1"].events[ "event1" ]; - const expectedUrl = `test/mailto/?uri=mailto:john@test.com?subject=Test Event`; + const expectedUrl = `test/mailto/?uri=mailto:john@test.com?subject=Test%20Event`; + + expect(mockOpen).toHaveBeenCalledWith(expectedUrl); + }); + + it("message button encodes special characters in event title correctly", () => { + (window as any).MAIL_SPA_URL = "test"; + const mockOpen = jest.fn(); + window.open = mockOpen; + + const specialCharState = { + ...preloadedState, + calendars: { + ...preloadedState.calendars, + list: { + ...preloadedState.calendars.list, + "667037022b752d0026472254/cal1": { + ...preloadedState.calendars.list["667037022b752d0026472254/cal1"], + events: { + ...preloadedState.calendars.list["667037022b752d0026472254/cal1"] + .events, + eventWithSpecialChars: { + uid: "eventWithSpecialChars", + title: "Meeting & Discussion? #Important", + calId: "667037022b752d0026472254/cal1", + start: day.toISOString(), + end: day.toISOString(), + organizer: { cn: "test", cal_address: "test@test.com" }, + attendee: [ + { + cn: "test", + cal_address: "test@test.com", + partstat: "NEEDS-ACTION", + rsvp: "TRUE", + role: "REQ-PARTICIPANT", + cutype: "INDIVIDUAL", + }, + { + cn: "John", + cal_address: "john@test.com", + partstat: "NEEDS-ACTION", + rsvp: "TRUE", + role: "REQ-PARTICIPANT", + cutype: "INDIVIDUAL", + }, + ], + }, + }, + }, + }, + }, + }; + + renderWithProviders( + , + specialCharState + ); + + fireEvent.click(screen.getByTestId("MoreVertIcon")); + const emailButton = screen.getByRole("menuitem", { + name: "eventPreview.emailAttendees", + }); + expect(emailButton).toBeInTheDocument(); + + fireEvent.click(emailButton); + + const expectedUrl = `test/mailto/?uri=mailto:john@test.com?subject=Meeting%20%26%20Discussion%3F%20%23Important`; expect(mockOpen).toHaveBeenCalledWith(expectedUrl); }); diff --git a/rsbuild.config.ts b/rsbuild.config.ts index 6a0d427..71c1992 100644 --- a/rsbuild.config.ts +++ b/rsbuild.config.ts @@ -29,9 +29,4 @@ export default defineConfig({ "react-dom": require.resolve("react-dom"), }, }, - performance: { - chunkOverflow: { - maxAssetSize: 2000000, - }, - }, }); diff --git a/src/components/Calendar/CalendarItemList.tsx b/src/components/Calendar/CalendarItemList.tsx index 9a7f42c..8a05851 100644 --- a/src/components/Calendar/CalendarItemList.tsx +++ b/src/components/Calendar/CalendarItemList.tsx @@ -1,10 +1,10 @@ import React from "react"; import { MenuItem } from "@linagora/twake-mui"; -import { Calendars } from "../../features/Calendars/CalendarTypes"; +import { Calendar } from "../../features/Calendars/CalendarTypes"; import { CalendarName } from "./CalendarName"; export function CalendarItemList( - userPersonalCalendars: Calendars[] + userPersonalCalendars: Calendar[] ): React.ReactNode { return Object.values(userPersonalCalendars).map((calendar) => ( diff --git a/src/components/Calendar/CalendarName.tsx b/src/components/Calendar/CalendarName.tsx index c2754c6..d1daf33 100644 --- a/src/components/Calendar/CalendarName.tsx +++ b/src/components/Calendar/CalendarName.tsx @@ -1,7 +1,7 @@ import { Box, Typography } from "@linagora/twake-mui"; -import { Calendars } from "../../features/Calendars/CalendarTypes"; +import { Calendar } from "../../features/Calendars/CalendarTypes"; import SquareRoundedIcon from "@mui/icons-material/SquareRounded"; -export function CalendarName({ calendar }: { calendar: Calendars }) { +export function CalendarName({ calendar }: { calendar: Calendar }) { return ( ; + calendars: Record; selectedCal: CalendarWithOwner[]; onRemove: (cal: CalendarWithOwner) => void; onColorChange: ( diff --git a/src/components/Calendar/DeleteCalendarDialog.tsx b/src/components/Calendar/DeleteCalendarDialog.tsx index 86cce19..a16d009 100644 --- a/src/components/Calendar/DeleteCalendarDialog.tsx +++ b/src/components/Calendar/DeleteCalendarDialog.tsx @@ -6,7 +6,7 @@ import { DialogActions, Button, } from "@linagora/twake-mui"; -import { Calendars } from "../../features/Calendars/CalendarTypes"; +import { Calendar } from "../../features/Calendars/CalendarTypes"; import { useI18n } from "twake-i18n"; export function DeleteCalendarDialog({ @@ -19,7 +19,7 @@ export function DeleteCalendarDialog({ }: { deletePopupOpen: boolean; setDeletePopupOpen: (e: boolean) => void; - calendars: Record; + calendars: Record; id: string; isPersonal: boolean; handleDeleteConfirm: () => void; diff --git a/src/components/Menubar/Menubar.tsx b/src/components/Menubar/Menubar.tsx index 9ec237a..fc57da9 100644 --- a/src/components/Menubar/Menubar.tsx +++ b/src/components/Menubar/Menubar.tsx @@ -8,7 +8,6 @@ import SettingsIcon from "@mui/icons-material/Settings"; import LogoutIcon from "@mui/icons-material/Logout"; import "./Menubar.styl"; import { useAppDispatch, useAppSelector } from "../../app/hooks"; -import { stringToColor } from "../Event/utils/eventUtils"; import { stringToGradient } from "../../utils/avatarUtils"; import { Avatar, diff --git a/src/features/Events/EventDisplayPreview.tsx b/src/features/Events/EventDisplayPreview.tsx index ed3e70e..c2dc159 100644 --- a/src/features/Events/EventDisplayPreview.tsx +++ b/src/features/Events/EventDisplayPreview.tsx @@ -99,7 +99,7 @@ export default function EventPreviewModal({ const attendeePreview = makeAttendeePreview(event.attendee, t); const hasCheckedSessionStorageRef = useRef(false); - const [toggleActionMenu, setToggleActionMenu] = useState( + const [toggleActionMenu, setToggleActionMenu] = useState( null ); const mailSpaUrl = (window as any).MAIL_SPA_URL ?? null; @@ -368,7 +368,9 @@ export default function EventPreviewModal({ `${mailSpaUrl}/mailto/?uri=mailto:${event.attendee .map((a) => a.cal_address) .filter((mail) => mail !== user.email) - .join(",")}?subject=${encodeURIComponent(event.title ?? "")}` + .join( + "," + )}?subject=${encodeURIComponent(event.title ?? "")}` ) } >