mirror of
https://github.com/bulwarkmail/webmail.git
synced 2026-11-04 08:15:41 +00:00
fix: let plugins answer invitations found by a search of the user's own mail
This commit is contained in:
@@ -92,6 +92,13 @@ describe('api.calendar.respond', () => {
|
||||
expect(store.rsvpEvent).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('answers a message the list names with the account of the user', async () => {
|
||||
// Search results carry their account, the user's own one included.
|
||||
useEmailStore.setState({ emails: [{ id: 'inv', sourceClientAccountId: 'login1', sourceAccountId: 'acc1' }] } as never);
|
||||
useAuthStore.setState({ getClientForAccount: () => client } as never);
|
||||
await expect(call(ASSISTANT, 'calendar.respond', 'inv', 'accepted')).resolves.toMatchObject({ status: 'accepted' });
|
||||
});
|
||||
|
||||
it('refuses mail of another account, a bad status and plugins without calendar:respond', async () => {
|
||||
useEmailStore.setState({ emails: [{ id: 'inv', sourceClientAccountId: 'login1', sourceAccountId: 'acc2' }] } as never);
|
||||
useAuthStore.setState({ getClientForAccount: () => client } as never);
|
||||
|
||||
@@ -65,8 +65,9 @@ export async function doCalendarRespond(emailIdArg: unknown, statusArg: unknown)
|
||||
|
||||
const named = await readNamedEmail(client, emailId, method);
|
||||
if (!named) throw new Error(`${method}: no message with id "${emailId}"`);
|
||||
// Mail of a shared or group mailbox is answered as that account: only in the reader.
|
||||
if (named.accountId !== undefined) throw new Error(`${method}: answer invitations of other accounts in the reader`);
|
||||
// Mail of a shared or group mailbox is answered as that account: only in
|
||||
// the reader. Search results name the user's own account too.
|
||||
if (named.accountId !== undefined && named.accountId !== client.getAccountId()) throw new Error(`${method}: answer invitations of other accounts in the reader`);
|
||||
const { email } = named;
|
||||
|
||||
const invitation = await readOwnInvitation(client, email);
|
||||
|
||||
Reference in New Issue
Block a user