Remove fetching thread summaries when homeserver do not support MSC3440

This commit is contained in:
ariskotsomitopoulos 2022-02-28 12:35:27 +02:00
parent 8b254212af
commit eda723c230
2 changed files with 8 additions and 5 deletions

View file

@ -70,7 +70,8 @@ internal data class Capabilities(
* Capability to indicate if the server supports MSC3440 Threading
* True if the user can use m.thread relation, false otherwise
*/
@Json(name = "m.thread")
// @Json(name = "m.thread")
@Json(name = "io.element.thread")
val threads: BooleanCapability? = null
)

View file

@ -54,8 +54,7 @@ class ThreadListViewModel @AssistedInject constructor(@Assisted val initialState
}
init {
observeThreads()
fetchThreadList()
fetchAndObserveThreads()
}
override fun handle(action: EmptyAction) {}
@ -64,9 +63,12 @@ class ThreadListViewModel @AssistedInject constructor(@Assisted val initialState
* Observing thread list with respect to homeserver
* capabilities
*/
private fun observeThreads() {
private fun fetchAndObserveThreads() {
when (session.getHomeServerCapabilities().canUseThreading) {
true -> observeThreadSummaries()
true -> {
fetchThreadList()
observeThreadSummaries()
}
false -> observeThreadsList()
}
}