diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/RealmSessionStoreMigration.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/RealmSessionStoreMigration.kt index e7968b8786..04c48a1889 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/RealmSessionStoreMigration.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/RealmSessionStoreMigration.kt @@ -25,6 +25,7 @@ import org.matrix.android.sdk.api.session.room.model.RoomJoinRulesContent import org.matrix.android.sdk.api.session.room.model.VersioningState import org.matrix.android.sdk.api.session.room.model.create.RoomCreateContent import org.matrix.android.sdk.api.session.room.model.tag.RoomTag +import org.matrix.android.sdk.api.session.threads.ThreadNotificationState import org.matrix.android.sdk.internal.database.model.ChunkEntityFields import org.matrix.android.sdk.internal.database.model.CurrentStateEventEntityFields import org.matrix.android.sdk.internal.database.model.EditAggregatedSummaryEntityFields @@ -403,6 +404,9 @@ internal class RealmSessionStoreMigration @Inject constructor( ?.addField(EventEntityFields.ROOT_THREAD_EVENT_ID, String::class.java, FieldAttribute.INDEXED) ?.addField(EventEntityFields.NUMBER_OF_THREADS, Int::class.java) ?.addField(EventEntityFields.THREAD_NOTIFICATION_STATE_STR, String::class.java) + ?.transform { + it.setString(EventEntityFields.THREAD_NOTIFICATION_STATE_STR, ThreadNotificationState.NO_NEW_MESSAGE.name) + } ?.addRealmObjectField(EventEntityFields.THREAD_SUMMARY_LATEST_MESSAGE.`$`, eventEntity) } } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/timeline/DefaultTimeline.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/timeline/DefaultTimeline.kt index 00388dc5fa..78ebe82129 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/timeline/DefaultTimeline.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/timeline/DefaultTimeline.kt @@ -602,8 +602,11 @@ internal class DefaultTimeline( nextDisplayIndex = offsetIndex + 1 } - // Prerequisite to in order for the ThreadsAwarenessHandler to work properly - fetchRootThreadEventsIfNeeded(offsetResults) + + if(!BuildConfig.THREADING_ENABLED) { + // Prerequisite to in order for the ThreadsAwarenessHandler to work properly + fetchRootThreadEventsIfNeeded(offsetResults) + } offsetResults.forEach { eventEntity -> @@ -640,9 +643,7 @@ internal class DefaultTimeline( }.map { EventMapper.map(it) } - if(!BuildConfig.THREADING_ENABLED) { threadsAwarenessHandler.fetchRootThreadEventsIfNeeded(eventEntityList) - } } private fun buildTimelineEvent(eventEntity: TimelineEventEntity): TimelineEvent {