mirror of
https://github.com/bitwarden/android.git
synced 2026-03-12 05:04:17 -05:00
PM-17680: Overwrite the expiration date to the deletion date (#4642)
This commit is contained in:
@@ -31,7 +31,11 @@ fun AddSendState.ViewState.Content.toSendView(
|
||||
hideEmail = common.isHideEmailChecked,
|
||||
revisionDate = clock.instant(),
|
||||
deletionDate = common.deletionDate.toInstant(),
|
||||
expirationDate = common.expirationDate?.toInstant(),
|
||||
expirationDate = common.expirationDate?.let {
|
||||
// We no longer support expiration dates but is a send has one already,
|
||||
// we just update it to match the deletion date.
|
||||
common.deletionDate.toInstant()
|
||||
},
|
||||
)
|
||||
|
||||
private fun AddSendState.ViewState.Content.SendType.toSendType(): SendType =
|
||||
|
||||
@@ -58,6 +58,31 @@ class AddSendStateExtensionsTest {
|
||||
|
||||
assertEquals(sendView, result)
|
||||
}
|
||||
|
||||
@Suppress("MaxLineLength")
|
||||
@Test
|
||||
fun `toSendView should create an appropriate SendView with expiration date set to deletion date`() {
|
||||
val sendView = createMockSendView(number = 1, type = SendType.TEXT).copy(
|
||||
id = null,
|
||||
accessId = null,
|
||||
key = null,
|
||||
accessCount = 0U,
|
||||
hasPassword = false,
|
||||
deletionDate = ZonedDateTime.parse("2030-10-27T12:00:00Z").toInstant(),
|
||||
expirationDate = ZonedDateTime.parse("2030-10-27T12:00:00Z").toInstant(),
|
||||
)
|
||||
|
||||
val result = DEFAULT_VIEW_STATE
|
||||
.copy(
|
||||
common = DEFAULT_COMMON_STATE.copy(
|
||||
deletionDate = ZonedDateTime.parse("2030-10-27T12:00:00Z"),
|
||||
expirationDate = ZonedDateTime.parse("2026-10-27T12:00:00Z"),
|
||||
),
|
||||
)
|
||||
.toSendView(FIXED_CLOCK)
|
||||
|
||||
assertEquals(sendView, result)
|
||||
}
|
||||
}
|
||||
|
||||
private val FIXED_CLOCK: Clock = Clock.fixed(
|
||||
|
||||
Reference in New Issue
Block a user