Skip to content

Commit

Permalink
[CIS-1042] Fix deleted message's appearance on channel list (#1318)
Browse files Browse the repository at this point in the history
* Fix deleted last message's text on channel list

* Update CHANGELOG
  • Loading branch information
SagarSDagdu authored Jul 26, 2021
1 parent ef7eaa7 commit 6acd58c
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Renamed `Components.navigationTitleView` -> `Components.titleContainerView` [#12

### 🐞 Fixed
- Fix message list header displaying incorrectly the online status for the current user instead of the other one [#1294](https://github.com/GetStream/stream-chat-swift/pull/1294)
- Fix deleted last message's appearance on channels list [#1318](https://github.com/GetStream/stream-chat-swift/pull/1318)

### 🔄 Changed

Expand Down
4 changes: 4 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -779,8 +779,12 @@ var streamChatUIFilesExcluded: [String] { [
"ChatChannelList/ChatChannelListVC_Tests.swift",
"ChatChannelList/SwipeableView_Tests.swift",
"ChatChannelList/__Snapshots__/ChatChannelListVC_Tests/test_appearanceCustomization_usingComponents.default-dark.png",
"ChatChannelList/__Snapshots__/ChatChannelListVC_Tests/test_LastMessageDeletedAppearance.small-dark.png",
"ChatChannelList/__Snapshots__/ChatChannelListVC_Tests/test_defaultAppearance.default-light.png",
"ChatChannelList/__Snapshots__/ChatChannelListVC_Tests/test_LastMessageDeletedAppearance.default-light.png",
"ChatChannelList/__Snapshots__/ChatChannelListVC_Tests/test_emptyAppearance.extraExtraExtraLarge-light.png",
"ChatChannelList/__Snapshots__/ChatChannelListVC_Tests/test_LastMessageDeletedAppearance.rightToLeftLayout-default.png",
"ChatChannelList/__Snapshots__/ChatChannelListVC_Tests/test_LastMessageDeletedAppearance.extraExtraExtraLarge-light.png",
"ChatChannelList/__Snapshots__/ChatChannelListVC_Tests/test_appearanceCustomization_usingComponents.default-light.png",
"ChatChannelList/__Snapshots__/ChatChannelListVC_Tests/test_defaultAppearance.rightToLeftLayout-default.png",
"ChatChannelList/__Snapshots__/ChatChannelListVC_Tests/test_emptyAppearance.default-light.png",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ open class _ChatChannelListItemView<ExtraData: ExtraDataTypes>: _View, ThemeProv
if let typingUsersInfo = typingUserString {
return typingUsersInfo
} else if let latestMessage = content.channel.latestMessages.first {
return "\(latestMessage.author.name ?? latestMessage.author.id): \(latestMessage.text)"
return "\(latestMessage.author.name ?? latestMessage.author.id): \(latestMessage.textContent ?? latestMessage.text)"
} else {
return L10n.Channel.Item.emptyMessages
}
Expand Down
24 changes: 24 additions & 0 deletions Sources/StreamChatUI/ChatChannelList/ChatChannelListVC_Tests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,30 @@ class ChatChannelListVC_Tests: XCTestCase {
)
AssertSnapshot(vc, isEmbeddedInNavigationController: true)
}

func test_LastMessageDeletedAppearance() {
let channelWithLastMessageDeleted = ChatChannel.mock(
cid: .init(type: .messaging, id: "test_channel5"),
name: "Channel 5",
imageURL: XCTestCase.TestImages.vader.url,
lastMessageAt: .init(timeIntervalSince1970: 1_611_951_530_000),
latestMessages: [
ChatMessage.mock(
id: "2",
cid: .unique,
text: "Hello",
author: .mock(id: "Vader"),
deletedAt: .init(timeIntervalSince1970: 1_611_951_532_000)
),
ChatMessage.mock(id: "1", cid: .unique, text: "Hello2", author: .mock(id: "Vader2"))
]
)
mockedChannelListController.simulate(
channels: [channelWithLastMessageDeleted],
changes: []
)
AssertSnapshot(vc, isEmbeddedInNavigationController: true)
}

func test_appearanceCustomization_usingComponents() {
class TestView: CellSeparatorReusableView {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 6acd58c

Please sign in to comment.