PR Remarks

This commit is contained in:
ariskotsomitopoulos 2021-11-04 12:15:22 +02:00
parent 4192c1cf81
commit ec366f1346
3 changed files with 7 additions and 2 deletions

View file

@ -28,6 +28,10 @@ object RelationType {
/** Lets you define an event which references an existing event.*/ /** Lets you define an event which references an existing event.*/
const val REFERENCE = "m.reference" const val REFERENCE = "m.reference"
/** Lets you define an thread event that belongs to another existing event.*/
// const val THREAD = "m.thread" // m.thread is not yet released in the backend
const val THREAD = "io.element.thread" // io.element.thread will be replaced by m.thread when it is released
/** Lets you define an event which adds a response to an existing event.*/ /** Lets you define an event which adds a response to an existing event.*/
const val RESPONSE = "org.matrix.response" const val RESPONSE = "org.matrix.response"
} }

View file

@ -619,7 +619,7 @@ internal class DefaultTimeline(
it?.root it?.root
}.map { }.map {
EventMapper.map(it) EventMapper.map(it)
}.toList() }
threadsAwarenessHandler.fetchRootThreadEventsIfNeeded(eventEntityList) threadsAwarenessHandler.fetchRootThreadEventsIfNeeded(eventEntityList)
} }

View file

@ -22,6 +22,7 @@ import org.matrix.android.sdk.api.session.Session
import org.matrix.android.sdk.api.session.crypto.CryptoService import org.matrix.android.sdk.api.session.crypto.CryptoService
import org.matrix.android.sdk.api.session.crypto.MXCryptoError import org.matrix.android.sdk.api.session.crypto.MXCryptoError
import org.matrix.android.sdk.api.session.events.model.Event import org.matrix.android.sdk.api.session.events.model.Event
import org.matrix.android.sdk.api.session.events.model.RelationType
import org.matrix.android.sdk.api.session.events.model.toContent import org.matrix.android.sdk.api.session.events.model.toContent
import org.matrix.android.sdk.api.session.events.model.toModel import org.matrix.android.sdk.api.session.events.model.toModel
import org.matrix.android.sdk.api.session.room.model.message.MessageFormat import org.matrix.android.sdk.api.session.room.model.message.MessageFormat
@ -247,7 +248,7 @@ internal class ThreadsAwarenessHandler @Inject constructor(
* @param event * @param event
*/ */
private fun isThreadEvent(event: Event): Boolean = private fun isThreadEvent(event: Event): Boolean =
event.content.toModel<MessageRelationContent>()?.relatesTo?.type == "io.element.thread" event.content.toModel<MessageRelationContent>()?.relatesTo?.type == RelationType.THREAD
/** /**
* Returns the root thread eventId or null otherwise * Returns the root thread eventId or null otherwise