Using copy() on realm object when getting current poll history status

This commit is contained in:
Maxime NATUREL 2023-01-23 15:07:18 +01:00
parent cd1f41594d
commit 63026a3da5

View file

@ -38,7 +38,9 @@ internal class DefaultGetLoadedPollsStatusTask @Inject constructor(
override suspend fun execute(params: GetLoadedPollsStatusTask.Params): LoadedPollsStatus { override suspend fun execute(params: GetLoadedPollsStatusTask.Params): LoadedPollsStatus {
return monarchy.awaitTransaction { realm -> return monarchy.awaitTransaction { realm ->
val status = PollHistoryStatusEntity.getOrCreate(realm, params.roomId) val status = PollHistoryStatusEntity
.getOrCreate(realm, params.roomId)
.copy()
LoadedPollsStatus( LoadedPollsStatus(
canLoadMore = status.isEndOfPollsBackward.not(), canLoadMore = status.isEndOfPollsBackward.not(),
nbSyncedDays = status.getNbSyncedDays(params.currentTimestampMs), nbSyncedDays = status.getNbSyncedDays(params.currentTimestampMs),