Remove eventType from /relations api for threads

This commit is contained in:
ariskotsomitopoulos 2022-03-08 16:41:38 +02:00
parent 8c6902aa23
commit a53d5bdba2
2 changed files with 15 additions and 6 deletions

View file

@ -18,6 +18,7 @@ package org.matrix.android.sdk.internal.session.room
import org.matrix.android.sdk.api.session.events.model.Content
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.room.model.Membership
import org.matrix.android.sdk.api.session.room.model.RoomStrippedState
import org.matrix.android.sdk.api.session.room.model.roomdirectory.PublicRoomsParams
@ -218,7 +219,6 @@ internal interface RoomAPI {
/**
* Paginate relations for event based in normal topological order
*
* @param relationType filter for this relation type
* @param eventType filter for this event type
*/
@ -232,6 +232,19 @@ internal interface RoomAPI {
@Query("limit") limit: Int? = null
): RelationsResponse
/**
* Paginate relations for thread events based in normal topological order
* @param relationType filter for this relation type
*/
@GET(NetworkConstants.URI_API_PREFIX_PATH_UNSTABLE + "rooms/{roomId}/relations/{eventId}/{relationType}")
suspend fun getThreadsRelations(@Path("roomId") roomId: String,
@Path("eventId") eventId: String,
@Path("relationType") relationType: String = RelationType.IO_THREAD,
@Query("from") from: String? = null,
@Query("to") to: String? = null,
@Query("limit") limit: Int? = null
): RelationsResponse
/**
* Join the given room.
*

View file

@ -20,7 +20,6 @@ import io.realm.Realm
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.EventType
import org.matrix.android.sdk.api.session.events.model.RelationType
import org.matrix.android.sdk.api.session.room.model.RoomMemberContent
import org.matrix.android.sdk.api.session.room.send.SendState
import org.matrix.android.sdk.internal.crypto.CryptoSessionInfoProvider
@ -99,14 +98,11 @@ internal class DefaultFetchThreadTimelineTask @Inject constructor(
}
override suspend fun execute(params: FetchThreadTimelineTask.Params): Result {
val isRoomEncrypted = cryptoSessionInfoProvider.isRoomEncrypted(params.roomId)
val response = executeRequest(globalErrorReceiver) {
roomAPI.getRelations(
roomAPI.getThreadsRelations(
roomId = params.roomId,
eventId = params.rootThreadEventId,
relationType = RelationType.IO_THREAD,
from = params.from,
eventType = if (isRoomEncrypted) EventType.ENCRYPTED else EventType.MESSAGE,
limit = params.limit
)
}