fix(email): restore the sender identity when reopening a draft
Reopening a draft reset the composer's From to the default identity. The edit-draft handler matched the draft's saved From against the active-account identity list by email only, so two identities sharing an address (a default + an alias differing by name) collided — the wrong one was picked, or with cross-account namespaced ids none was. Add findDraftIdentityId (name+email, normalized, +tag fallback) and match against the same list the composer renders (the flat cross-account list when multi- account is on). Wired into both the classic and Pro edit-draft paths. Unit tests plus the un-pinned 07-drafts integration spec.
This commit is contained in:
@@ -120,12 +120,10 @@ test.describe('Drafts', () => {
|
||||
expect((draft.from ?? [])[0]?.name, 'draft From carries the selected identity').toBe('Alice Team');
|
||||
});
|
||||
|
||||
// KNOWN BUG (documented via test.fail): a draft composed with a non-default
|
||||
// identity is saved with the right From on the server (see the test above),
|
||||
// but reopening the draft resets the composer's From selector to the default
|
||||
// identity instead of restoring the one the draft was written with. If this
|
||||
// starts passing, the reopen path was fixed — flip this back to a plain test.
|
||||
test.fail('reopening a draft restores the changed sender in the From selector', async ({ page }) => {
|
||||
// Regression: reopening a draft must restore the identity it was written with
|
||||
// (drafts store the From address+name, not an identity id, so the reopen path
|
||||
// matches name+address against the identity list — see findDraftIdentityId).
|
||||
test('reopening a draft restores the changed sender in the From selector', async ({ page }) => {
|
||||
const altId = await jmap.ensureIdentity('Alice Team', alice.email);
|
||||
const subject = subj('draft-from-reopen');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user