Skip to content

Conversation

@VelikovPetar
Copy link
Contributor

@VelikovPetar VelikovPetar commented Nov 25, 2025

🎯 Goal

Introduce the option to hide the channel history before a given timestamp for newly added members.
Resolves: https://linear.app/stream/issue/AND-923/llc-support

🛠 Implementation details

  • Adds the hideHistoryBefore parameter to the ChatClient.addMembers() and ChannelClient.addMembers() methods.

🎨 UI Changes

No UI changes, LLC only

🧪 Testing

  1. Apply the provided patch (sets hideHistoryBefore to 1 day ago)
  2. Open a channel where you are owner
  3. Add a new member
  4. The member should only see the messages from the last day
Set hideHistoryBefore (patch)
Index: stream-chat-android-compose-sample/src/main/java/io/getstream/chat/android/compose/sample/ui/channel/AddMembersViewModel.kt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/stream-chat-android-compose-sample/src/main/java/io/getstream/chat/android/compose/sample/ui/channel/AddMembersViewModel.kt b/stream-chat-android-compose-sample/src/main/java/io/getstream/chat/android/compose/sample/ui/channel/AddMembersViewModel.kt
--- a/stream-chat-android-compose-sample/src/main/java/io/getstream/chat/android/compose/sample/ui/channel/AddMembersViewModel.kt	(revision 7f3d80a90f912e90556e71f2e28b6a5253eae777)
+++ b/stream-chat-android-compose-sample/src/main/java/io/getstream/chat/android/compose/sample/ui/channel/AddMembersViewModel.kt	(date 1764099246140)
@@ -44,6 +44,8 @@
 import kotlinx.coroutines.flow.onEach
 import kotlinx.coroutines.flow.update
 import kotlinx.coroutines.launch
+import java.util.Date
+import kotlin.time.Duration.Companion.days
 
 class AddMembersViewModel(
     private val cid: String,
@@ -122,6 +124,10 @@
                     val params = AddMembersParams(
                         members = _state.value.selectedUsers.map { user -> MemberData(user.id) },
                         systemMessage = null,
+                        hideHistoryBefore = Date().apply {
+                            // 1 day before
+                            time = time - 1.days.inWholeMilliseconds
+                        }
                     )
                     chatClient
                         .channel(cid)

Demo
Screen.Recording.2025-11-25.at.20.35.57.mov

@github-actions
Copy link
Contributor

github-actions bot commented Nov 25, 2025

SDK Size Comparison 📏

SDK Before After Difference Status
stream-chat-android-client 5.25 MB 5.25 MB 0.00 MB 🟢
stream-chat-android-offline 5.47 MB 5.47 MB 0.00 MB 🟢
stream-chat-android-ui-components 10.58 MB 10.58 MB 0.00 MB 🟢
stream-chat-android-compose 12.81 MB 12.81 MB 0.00 MB 🟢

@VelikovPetar VelikovPetar marked this pull request as ready for review November 26, 2025 08:23
@VelikovPetar VelikovPetar requested a review from a team as a code owner November 26, 2025 08:23
@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
77.8% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@VelikovPetar VelikovPetar merged commit 5b09957 into develop Nov 26, 2025
12 of 13 checks passed
@VelikovPetar VelikovPetar deleted the feature/add_hide_history_before branch November 26, 2025 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants