Invite the people the message was already between
Follow-up to #167: an event made from a mail now opens with the sender and everyone it was addressed to already in the guest list, so a thread becomes a meeting without retyping the room. Two things are deliberately left out. The reader's own addresses, since they are the organiser and an organiser among their own guests is an invitation to your own appointment. And a blind copy, on a message the reader sent: a guest list is visible to every guest, so promoting a Bcc to a guest would tell the room about a copy the sender chose to hide. That is not something a menu item may do quietly. *Send invitation emails to guests* now starts off when the guests were inherited rather than typed, and on everywhere else -- which is every event whose guests somebody chose one at a time. The reason is the case the issue opened with: a reminder made out of a bill carries the biller and everyone else on the mail. Left on, the primary button reads Send invites and the first press mails all of them an invitation to what was meant as a note to self. The switch sits right there under the list and says what it does, so inviting them is one deliberate click. Un-sending is not.
This commit is contained in:
@@ -68,3 +68,42 @@ describe("what is copied from the message", () => {
|
||||
expect(d.description.endsWith("…")).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
const between = (parts: Partial<Email>) => email({ subject: "Kickoff", ...parts });
|
||||
const addr = (email: string, name: string | null = null) => ({ name, email });
|
||||
|
||||
describe("who is invited", () => {
|
||||
it("carries the sender and everyone it was addressed to", () => {
|
||||
const d = appointmentDraft(
|
||||
between({ from: [addr("[email protected]", "Grace")], to: [addr("[email protected]"), addr("[email protected]")], cc: [addr("[email protected]")] }),
|
||||
new Date(),
|
||||
["[email protected]"],
|
||||
);
|
||||
expect(d.attendees.map((a) => a.email)).toEqual(["[email protected]", "[email protected]", "[email protected]"]);
|
||||
expect(d.attendees[0]?.name).toBe("Grace");
|
||||
});
|
||||
|
||||
it("leaves the reader out, whatever case their address was written in", () => {
|
||||
const d = appointmentDraft(between({ from: [addr("[email protected]")], to: [addr("[email protected]")] }), new Date(), ["[email protected]"]);
|
||||
expect(d.attendees.map((a) => a.email)).toEqual(["[email protected]"]);
|
||||
});
|
||||
|
||||
it("counts someone once, however many headers they appear in", () => {
|
||||
const d = appointmentDraft(between({ from: [addr("[email protected]")], to: [addr("[email protected]")], cc: [addr("[email protected]")] }));
|
||||
expect(d.attendees).toHaveLength(1);
|
||||
});
|
||||
|
||||
/*
|
||||
* On a message the reader sent, a blind copy is still a recipient — and
|
||||
* putting one on a guest list shows them to every other guest. Turning a
|
||||
* hidden copy into a visible one is not something a menu item may do.
|
||||
*/
|
||||
it("never turns a blind copy into a guest", () => {
|
||||
const d = appointmentDraft(between({ from: [addr("[email protected]")], to: [addr("[email protected]")], bcc: [addr("[email protected]")] }), new Date(), ["[email protected]"]);
|
||||
expect(d.attendees.map((a) => a.email)).toEqual(["[email protected]"]);
|
||||
});
|
||||
|
||||
it("invites nobody when the message has no addresses at all", () => {
|
||||
expect(appointmentDraft(between({})).attendees).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user