Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,10 @@ class EventStreamDelegate @Inject constructor(
// GetChat rather than waiting on a later update to correct it.
metadataDataSource.updateTitle(chatId, metaUpdate.newTitle)
}
is MetadataUpdate.DescriptionChanged -> {
// Same best-effort contract as TitleChanged above. Empty means cleared.
metadataDataSource.updateDescription(chatId, metaUpdate.newDescription)
}
is MetadataUpdate.PictureChanged -> {
// Same best-effort contract as TitleChanged above.
metadataDataSource.updatePicture(chatId, metaUpdate.newPicture)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,24 @@ class ChatMetadataEditStreamTest {
}
}

@Test
fun `a description change from the stream is stored`() = runTest(testDispatchers.dispatcher) {
tornDown {
triggerCollection()

chatUpdatesChannel.send(
ChatUpdate(
chatId = chatId,
metadataUpdates = listOf(MetadataUpdate.DescriptionChanged("New description")),
),
)
advanceTimeBy(1_000.milliseconds)
runCurrent()

coVerify(exactly = 1) { metadataDataSource.updateDescription(chatId, "New description") }
}
}

@Test
fun `a picture change from the stream is stored`() = runTest(testDispatchers.dispatcher) {
tornDown {
Expand Down
Loading
Loading