diff --git a/app/src/main/kotlin/org/libremail/ui/compose/ComposeViewModel.kt b/app/src/main/kotlin/org/libremail/ui/compose/ComposeViewModel.kt index 2ceff23..f010456 100644 --- a/app/src/main/kotlin/org/libremail/ui/compose/ComposeViewModel.kt +++ b/app/src/main/kotlin/org/libremail/ui/compose/ComposeViewModel.kt @@ -98,6 +98,7 @@ class ComposeViewModel @Inject constructor( it.copy( to = draft.to, cc = draft.cc, + bcc = draft.bcc, subject = draft.subject, body = draft.body, bodyHtml = draft.bodyHtml, diff --git a/app/src/test/kotlin/org/libremail/ui/compose/ComposeViewModelTest.kt b/app/src/test/kotlin/org/libremail/ui/compose/ComposeViewModelTest.kt index da82df2..0eace28 100644 --- a/app/src/test/kotlin/org/libremail/ui/compose/ComposeViewModelTest.kt +++ b/app/src/test/kotlin/org/libremail/ui/compose/ComposeViewModelTest.kt @@ -153,6 +153,27 @@ class ComposeViewModelTest { assertEquals("

Draft body

", vm.state.value.bodyHtml) } + @Test + fun `resuming a draft restores the bcc recipients`() = runTest(testDispatcher) { + val mailRepository = mockk(relaxed = true) + coEvery { mailRepository.getDraft("d1") } returns Draft( + id = "d1", + accountId = "imap:a", + to = "x@example.org", + cc = "", + bcc = "hidden@example.org", + subject = "Hi", + body = "Draft body", + updatedAt = 0L, + ) + val vm = viewModel( + savedState = SavedStateHandle(mapOf(Routes.COMPOSE_ARG_DRAFT to "d1")), + mailRepository = mailRepository, + ) + + assertEquals("hidden@example.org", vm.state.value.bcc) + } + @Test fun `send carries the HTML body through to the outgoing message`() = runTest(testDispatcher) { val mailRepository = mockk(relaxed = true)