mirror of
https://github.com/bulwarkmail/webmail.git
synced 2026-10-31 00:12:39 +00:00
fix: let a plugin move a single message that is not in the open list
This commit is contained in:
@@ -81,6 +81,18 @@ describe('api.email.move and archive', () => {
|
||||
expect(moveEmail).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
// An auto-filer moves new mail while the user looks at another folder.
|
||||
it('moves a single message that is not in the open list', async () => {
|
||||
const batchMoveEmails = vi.fn(async () => {});
|
||||
const moveEmail = vi.fn(async () => {});
|
||||
useAuthStore.setState({ client: { batchMoveEmails, moveEmail } as unknown as IJMAPClient });
|
||||
useEmailStore.setState({ moveEmailsToMailbox: storeMove, emails: [] } as never);
|
||||
|
||||
await call(WRITER, 'email.move', ['m9'], 'arch');
|
||||
|
||||
expect([...batchMoveEmails.mock.calls, ...moveEmail.mock.calls]).toEqual([[['m9'], 'arch', undefined]]);
|
||||
});
|
||||
|
||||
it('says when there is no Archive folder', async () => {
|
||||
useEmailStore.setState({ mailboxes: [inbox] });
|
||||
await expect(call(WRITER, 'email.archive', ['m1'])).rejects.toThrow(/no Archive folder/);
|
||||
|
||||
@@ -4214,7 +4214,9 @@ export const useEmailStore = create<EmailStore>((set, get) => ({
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (emailIds.length === 1) {
|
||||
// moveToMailbox acts on a listed row only; an id from elsewhere (a
|
||||
// plugin moving new mail) takes the batch path, or it was dropped.
|
||||
if (emailIds.length === 1 && get().emails.some(e => e.id === emailIds[0])) {
|
||||
return await get().moveToMailbox(client, emailIds[0], destinationMailboxId);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user