mirror of
https://github.com/element-hq/element-android
synced 2024-11-27 03:48:12 +03:00
Removing encrypted related id when receiving decrypted event
This commit is contained in:
parent
3b9faa5f31
commit
a29d4399a5
1 changed files with 10 additions and 3 deletions
|
@ -45,6 +45,7 @@ import org.matrix.android.sdk.internal.session.room.relation.poll.FetchPollRespo
|
|||
import org.matrix.android.sdk.internal.task.TaskExecutor
|
||||
import javax.inject.Inject
|
||||
|
||||
// TODO update unit tests
|
||||
internal class DefaultPollAggregationProcessor @Inject constructor(
|
||||
private val taskExecutor: TaskExecutor,
|
||||
private val fetchPollResponseEventsTask: FetchPollResponseEventsTask,
|
||||
|
@ -155,7 +156,7 @@ internal class DefaultPollAggregationProcessor @Inject constructor(
|
|||
)
|
||||
aggregatedPollSummaryEntity.aggregatedContent = ContentMapper.map(newSumModel.toContent())
|
||||
|
||||
// TODO check also if eventId is part of UTD list of eventIds, if so remove it
|
||||
event.eventId?.let { removeEncryptedRelatedEventIdIfNeeded(aggregatedPollSummaryEntity, it) }
|
||||
|
||||
return true
|
||||
}
|
||||
|
@ -182,12 +183,12 @@ internal class DefaultPollAggregationProcessor @Inject constructor(
|
|||
aggregatedPollSummaryEntity.sourceEvents.add(event.eventId)
|
||||
}
|
||||
|
||||
event.eventId?.let { removeEncryptedRelatedEventIdIfNeeded(aggregatedPollSummaryEntity, it) }
|
||||
|
||||
if (!isLocalEcho) {
|
||||
ensurePollIsFullyAggregated(roomId, pollEventId)
|
||||
}
|
||||
|
||||
// TODO check also if eventId is part of UTD list of eventIds, if so remove it
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
|
@ -230,4 +231,10 @@ internal class DefaultPollAggregationProcessor @Inject constructor(
|
|||
fetchPollResponseEventsTask.execute(params)
|
||||
}
|
||||
}
|
||||
|
||||
private fun removeEncryptedRelatedEventIdIfNeeded(aggregatedPollSummaryEntity: PollResponseAggregatedSummaryEntity, eventId: String) {
|
||||
if(aggregatedPollSummaryEntity.encryptedRelatedEventIds.contains(eventId)) {
|
||||
aggregatedPollSummaryEntity.encryptedRelatedEventIds.remove(eventId)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue