[#625] only call freebusy for attendees that have neither accepted nor declined
This commit is contained in:
committed by
Benoit TELLIER
parent
5269c43354
commit
d41cfe1186
@@ -652,7 +652,11 @@ describe("Event Preview Display", () => {
|
|||||||
|
|
||||||
const expectedUrl = `test/mailto/?uri=mailto%3Ajohn%40test.com&subject=Test%20Event`;
|
const expectedUrl = `test/mailto/?uri=mailto%3Ajohn%40test.com&subject=Test%20Event`;
|
||||||
|
|
||||||
expect(mockOpen).toHaveBeenCalledWith(expectedUrl);
|
expect(mockOpen).toHaveBeenCalledWith(
|
||||||
|
expectedUrl,
|
||||||
|
"_blank",
|
||||||
|
"noopener,noreferrer"
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("message button encodes special characters in event title correctly", () => {
|
it("message button encodes special characters in event title correctly", () => {
|
||||||
@@ -723,7 +727,11 @@ describe("Event Preview Display", () => {
|
|||||||
|
|
||||||
const expectedUrl = `test/mailto/?uri=mailto%3Ajohn%40test.com&subject=Meeting%20%26%20Discussion%3F%20%23Important`;
|
const expectedUrl = `test/mailto/?uri=mailto%3Ajohn%40test.com&subject=Meeting%20%26%20Discussion%3F%20%23Important`;
|
||||||
|
|
||||||
expect(mockOpen).toHaveBeenCalledWith(expectedUrl);
|
expect(mockOpen).toHaveBeenCalledWith(
|
||||||
|
expectedUrl,
|
||||||
|
"_blank",
|
||||||
|
"noopener,noreferrer"
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("Owner Email Permissions", () => {
|
describe("Owner Email Permissions", () => {
|
||||||
|
|||||||
@@ -40,9 +40,9 @@ import { TempCalendarsInput } from "./TempCalendarsInput";
|
|||||||
import { TimezoneSelector } from "./TimezoneSelector";
|
import { TimezoneSelector } from "./TimezoneSelector";
|
||||||
import { updateDarkColor } from "./utils/calendarColorsUtils";
|
import { updateDarkColor } from "./utils/calendarColorsUtils";
|
||||||
import {
|
import {
|
||||||
eventToFullCalendarFormat,
|
eventToFullCalendarFormat,
|
||||||
extractEvents,
|
extractEvents,
|
||||||
updateSlotLabelVisibility
|
updateSlotLabelVisibility,
|
||||||
} from "./utils/calendarUtils";
|
} from "./utils/calendarUtils";
|
||||||
|
|
||||||
const localeMap: Record<string, LocaleInput | undefined> = {
|
const localeMap: Record<string, LocaleInput | undefined> = {
|
||||||
|
|||||||
@@ -38,7 +38,9 @@ export function EventPreviewActionMenu({
|
|||||||
window.open(
|
window.open(
|
||||||
`${mailSpaUrl}/mailto/?uri=${encodeURIComponent(
|
`${mailSpaUrl}/mailto/?uri=${encodeURIComponent(
|
||||||
`mailto:${otherAttendees.map((a) => a.cal_address).join(",")}`
|
`mailto:${otherAttendees.map((a) => a.cal_address).join(",")}`
|
||||||
)}&subject=${encodeURIComponent(event.title ?? "")}`
|
)}&subject=${encodeURIComponent(event.title ?? "")}`,
|
||||||
|
"_blank",
|
||||||
|
"noopener,noreferrer"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { useAttendeesFreeBusy } from "@/components/Attendees/useFreeBusy";
|
import { useAttendeesFreeBusy } from "@/components/Attendees/useFreeBusy";
|
||||||
import { renderAttendeeBadge } from "@/components/Event/utils/eventUtils";
|
import { renderAttendeeBadge } from "@/components/Event/utils/eventUtils";
|
||||||
|
import { extractEventBaseUuid } from "@/utils/extractEventBaseUuid";
|
||||||
import { AvatarGroup, Box, Typography } from "@linagora/twake-mui";
|
import { AvatarGroup, Box, Typography } from "@linagora/twake-mui";
|
||||||
import PeopleAltOutlinedIcon from "@mui/icons-material/PeopleAltOutlined";
|
import PeopleAltOutlinedIcon from "@mui/icons-material/PeopleAltOutlined";
|
||||||
import { alpha, useTheme } from "@mui/material/styles";
|
import { alpha, useTheme } from "@mui/material/styles";
|
||||||
@@ -44,12 +45,17 @@ export function EventPreviewAttendees({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const freeBusyMap = useAttendeesFreeBusy({
|
const freeBusyMap = useAttendeesFreeBusy({
|
||||||
existingAttendees: allAttendees.map(toFreeBusyAttendee),
|
existingAttendees: allAttendees
|
||||||
|
.filter(
|
||||||
|
(attendee) =>
|
||||||
|
attendee.partstat !== "ACCEPTED" && attendee.partstat !== "DECLINED"
|
||||||
|
)
|
||||||
|
.map(toFreeBusyAttendee),
|
||||||
newAttendees: [],
|
newAttendees: [],
|
||||||
start: start ?? "",
|
start: start ?? "",
|
||||||
end: end ?? "",
|
end: end ?? "",
|
||||||
timezone: timezone ?? "UTC",
|
timezone: timezone ?? "UTC",
|
||||||
eventUid,
|
eventUid: extractEventBaseUuid(eventUid ?? ""),
|
||||||
enabled: !!(start && end && showAllAttendees),
|
enabled: !!(start && end && showAllAttendees),
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -107,14 +113,7 @@ export function EventPreviewAttendees({
|
|||||||
|
|
||||||
{showAllAttendees &&
|
{showAllAttendees &&
|
||||||
organizer &&
|
organizer &&
|
||||||
renderAttendeeBadge(
|
renderAttendeeBadge(organizer, "org", t, showAllAttendees, true)}
|
||||||
organizer,
|
|
||||||
"org",
|
|
||||||
t,
|
|
||||||
showAllAttendees,
|
|
||||||
true,
|
|
||||||
busyCaption(organizer)
|
|
||||||
)}
|
|
||||||
{showAllAttendees &&
|
{showAllAttendees &&
|
||||||
attendees.map((a, idx) =>
|
attendees.map((a, idx) =>
|
||||||
renderAttendeeBadge(
|
renderAttendeeBadge(
|
||||||
|
|||||||
@@ -30,7 +30,10 @@ export async function getFreeBusyForEventAttendeesPOST(
|
|||||||
});
|
});
|
||||||
if (!r.ok) throw new Error(`HTTP ${r.status}`);
|
if (!r.ok) throw new Error(`HTTP ${r.status}`);
|
||||||
|
|
||||||
const { users } = (await r.json()) as { users: UserFreeBusy[] };
|
const payload: unknown = await r.json();
|
||||||
|
const users = Array.isArray((payload as { users?: unknown })?.users)
|
||||||
|
? ((payload as { users: UserFreeBusy[] }).users ?? [])
|
||||||
|
: [];
|
||||||
|
|
||||||
const eventUidBase = extractEventBaseUuid(eventUid);
|
const eventUidBase = extractEventBaseUuid(eventUid);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user