Move local room check from UpdateBreadcrumbsTask to RoomService

This commit is contained in:
Florian Renaud 2022-09-19 15:22:17 +02:00
parent 8999b40c1a
commit 648498e2de
2 changed files with 5 additions and 4 deletions

View file

@ -33,6 +33,7 @@ import org.matrix.android.sdk.api.session.room.model.Membership
import org.matrix.android.sdk.api.session.room.model.RoomMemberSummary
import org.matrix.android.sdk.api.session.room.model.RoomSummary
import org.matrix.android.sdk.api.session.room.model.create.CreateRoomParams
import org.matrix.android.sdk.api.session.room.model.localecho.RoomLocalEcho
import org.matrix.android.sdk.api.session.room.peeking.PeekResult
import org.matrix.android.sdk.api.session.room.roomSummaryQueryParams
import org.matrix.android.sdk.api.session.room.summary.RoomAggregateNotificationCount
@ -173,7 +174,10 @@ internal class DefaultRoomService @Inject constructor(
}
override suspend fun onRoomDisplayed(roomId: String) {
updateBreadcrumbsTask.execute(UpdateBreadcrumbsTask.Params(roomId))
// Do not add local rooms to the recent rooms list as they should not be known by the server
if (!RoomLocalEcho.isLocalEchoId(roomId)) {
updateBreadcrumbsTask.execute(UpdateBreadcrumbsTask.Params(roomId))
}
}
override suspend fun joinRoom(roomIdOrAlias: String, reason: String?, viaServers: List<String>) {

View file

@ -17,7 +17,6 @@
package org.matrix.android.sdk.internal.session.user.accountdata
import com.zhuinden.monarchy.Monarchy
import org.matrix.android.sdk.api.session.room.model.localecho.RoomLocalEcho
import org.matrix.android.sdk.internal.database.model.BreadcrumbsEntity
import org.matrix.android.sdk.internal.database.query.get
import org.matrix.android.sdk.internal.di.SessionDatabase
@ -42,8 +41,6 @@ internal class DefaultUpdateBreadcrumbsTask @Inject constructor(
) : UpdateBreadcrumbsTask {
override suspend fun execute(params: UpdateBreadcrumbsTask.Params) {
// Do not add local rooms to the recent rooms list as they should not be known by the server
if (RoomLocalEcho.isLocalEchoId(params.newTopRoomId)) return
val newBreadcrumbs =
// Get the breadcrumbs entity, if any
monarchy.fetchCopied { BreadcrumbsEntity.get(it) }