-
Notifications
You must be signed in to change notification settings - Fork 274
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PBE-5181] fix pin expiration & pin inconsistency (#5329)
* AUTOMATION: Changelog update * [PBE-5181] pinning with expire date has no effect * [PBE-5250] Remove `url` property from `Attachment` class (#5325) * Remove `url` property from `Attachment` class * Update CHANGELOG.md * Increase database version * [PBE-5181] clear cache on message unpin --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Jc Miñarro <[email protected]>
- Loading branch information
1 parent
2a08e7d
commit 80569f3
Showing
15 changed files
with
145 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
...d-client/src/test/java/io/getstream/chat/android/client/utils/message/MessageUtilsTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/* | ||
* Copyright (c) 2014-2024 Stream.io Inc. All rights reserved. | ||
* | ||
* Licensed under the Stream License; | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://github.com/GetStream/stream-chat-android/blob/main/LICENSE | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.getstream.chat.android.client.utils.message | ||
|
||
import io.getstream.chat.android.randomMessage | ||
import kotlinx.coroutines.ExperimentalCoroutinesApi | ||
import kotlinx.coroutines.test.advanceTimeBy | ||
import kotlinx.coroutines.test.currentTime | ||
import kotlinx.coroutines.test.runTest | ||
import org.amshove.kluent.shouldBeEqualTo | ||
import org.junit.Test | ||
import java.util.Date | ||
|
||
@ExperimentalCoroutinesApi | ||
internal class MessageUtilsTest { | ||
|
||
@Test | ||
fun `validate message_isPinExpired`() = runTest { | ||
val message = randomMessage( | ||
pinned = true, | ||
pinExpires = Date(currentTime + 1000), | ||
) | ||
|
||
advanceTimeBy(2000) | ||
|
||
message.isPinExpired { currentTime } shouldBeEqualTo true | ||
} | ||
|
||
@Test | ||
fun `validate message_isPinned when pin expires`() = runTest { | ||
val message = randomMessage( | ||
pinned = true, | ||
pinExpires = Date(currentTime + 1000), | ||
) | ||
|
||
advanceTimeBy(2000) | ||
|
||
message.isPinned { currentTime } shouldBeEqualTo false | ||
} | ||
|
||
@Test | ||
fun `validate message_isPinned when message gets deleted`() = runTest { | ||
val message = randomMessage( | ||
pinned = true, | ||
deletedAt = Date(currentTime), | ||
) | ||
|
||
advanceTimeBy(2000) | ||
|
||
message.isPinned { currentTime } shouldBeEqualTo false | ||
} | ||
|
||
@Test | ||
fun `validate message_isPinned when message gets unpinned`() = runTest { | ||
val message = randomMessage( | ||
pinned = false, | ||
) | ||
|
||
message.isPinned { currentTime } shouldBeEqualTo false | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
stream-chat-android-offline/api/stream-chat-android-offline.api
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.