Improve home server capabilities for threads

This commit is contained in:
ariskotsomitopoulos 2022-02-21 12:14:51 +02:00
parent 83088bbe5a
commit f4f48b919e
3 changed files with 5 additions and 5 deletions

View File

@ -42,7 +42,7 @@ internal object HomeServerCapabilitiesMapper {
lastVersionIdentityServerSupported = entity.lastVersionIdentityServerSupported, lastVersionIdentityServerSupported = entity.lastVersionIdentityServerSupported,
defaultIdentityServerUrl = entity.defaultIdentityServerUrl, defaultIdentityServerUrl = entity.defaultIdentityServerUrl,
roomVersions = mapRoomVersion(entity.roomVersionsJson), roomVersions = mapRoomVersion(entity.roomVersionsJson),
canUseThreading = false // entity.canUseThreading canUseThreading = entity.canUseThreading
) )
} }

View File

@ -20,6 +20,7 @@ import com.zhuinden.monarchy.Monarchy
import org.matrix.android.sdk.api.MatrixPatterns.getDomain import org.matrix.android.sdk.api.MatrixPatterns.getDomain
import org.matrix.android.sdk.api.auth.data.HomeServerConnectionConfig import org.matrix.android.sdk.api.auth.data.HomeServerConnectionConfig
import org.matrix.android.sdk.api.auth.wellknown.WellknownResult import org.matrix.android.sdk.api.auth.wellknown.WellknownResult
import org.matrix.android.sdk.api.extensions.orFalse
import org.matrix.android.sdk.api.extensions.orTrue import org.matrix.android.sdk.api.extensions.orTrue
import org.matrix.android.sdk.api.session.homeserver.HomeServerCapabilities import org.matrix.android.sdk.api.session.homeserver.HomeServerCapabilities
import org.matrix.android.sdk.internal.auth.version.Versions import org.matrix.android.sdk.internal.auth.version.Versions
@ -121,7 +122,7 @@ internal class DefaultGetHomeServerCapabilitiesTask @Inject constructor(
homeServerCapabilitiesEntity.roomVersionsJson = capabilities?.roomVersions?.let { homeServerCapabilitiesEntity.roomVersionsJson = capabilities?.roomVersions?.let {
MoshiProvider.providesMoshi().adapter(RoomVersions::class.java).toJson(it) MoshiProvider.providesMoshi().adapter(RoomVersions::class.java).toJson(it)
} }
homeServerCapabilitiesEntity.canUseThreading = capabilities?.threads?.enabled.orTrue() homeServerCapabilitiesEntity.canUseThreading = capabilities?.threads?.enabled.orFalse()
} }
if (getMediaConfigResult != null) { if (getMediaConfigResult != null) {

View File

@ -64,7 +64,6 @@ import org.matrix.android.sdk.internal.di.UserId
import org.matrix.android.sdk.internal.extensions.clearWith import org.matrix.android.sdk.internal.extensions.clearWith
import org.matrix.android.sdk.internal.session.StreamEventsManager import org.matrix.android.sdk.internal.session.StreamEventsManager
import org.matrix.android.sdk.internal.session.events.getFixedRoomMemberContent import org.matrix.android.sdk.internal.session.events.getFixedRoomMemberContent
import org.matrix.android.sdk.internal.session.homeserver.DefaultHomeServerCapabilitiesService
import org.matrix.android.sdk.internal.session.initsync.ProgressReporter import org.matrix.android.sdk.internal.session.initsync.ProgressReporter
import org.matrix.android.sdk.internal.session.initsync.mapWithProgress import org.matrix.android.sdk.internal.session.initsync.mapWithProgress
import org.matrix.android.sdk.internal.session.initsync.reportSubtask import org.matrix.android.sdk.internal.session.initsync.reportSubtask
@ -425,8 +424,8 @@ internal class RoomSyncHandler @Inject constructor(private val readReceiptHandle
optimizedThreadSummaryMap[it] = eventEntity optimizedThreadSummaryMap[it] = eventEntity
// Add the same thread timeline event to Thread Chunk // Add the same thread timeline event to Thread Chunk
addToThreadChunkIfNeeded(realm, roomId, it, timelineEventAdded, roomEntity) addToThreadChunkIfNeeded(realm, roomId, it, timelineEventAdded, roomEntity)
// Add thread list if needed if (homeServerCapabilitiesService.getHomeServerCapabilities().canUseThreading) {
if(homeServerCapabilitiesService.getHomeServerCapabilities().canUseThreading) { // Update thread summaries only if homeserver supports threading
ThreadSummaryEntity.createOrUpdate( ThreadSummaryEntity.createOrUpdate(
threadSummaryType = ThreadSummaryUpdateType.ADD, threadSummaryType = ThreadSummaryUpdateType.ADD,
realm = realm, realm = realm,