Aggregate poll response events even when the poll start event has been received yet

This commit is contained in:
Maxime NATUREL 2023-02-13 17:55:11 +01:00
parent 67c2f0d288
commit 454ce1c095
1 changed files with 2 additions and 2 deletions

View File

@ -84,7 +84,6 @@ internal class DefaultPollAggregationProcessor @Inject constructor(
val roomId = event.roomId ?: return false val roomId = event.roomId ?: return false
val senderId = event.senderId ?: return false val senderId = event.senderId ?: return false
val targetEventId = event.getRelationContent()?.eventId ?: return false val targetEventId = event.getRelationContent()?.eventId ?: return false
val targetPollContent = getPollContent(session, roomId, targetEventId) ?: return false
val annotationsSummaryEntity = getAnnotationsSummaryEntity(realm, roomId, targetEventId) val annotationsSummaryEntity = getAnnotationsSummaryEntity(realm, roomId, targetEventId)
val aggregatedPollSummaryEntity = getAggregatedPollSummaryEntity(realm, annotationsSummaryEntity) val aggregatedPollSummaryEntity = getAggregatedPollSummaryEntity(realm, annotationsSummaryEntity)
@ -108,7 +107,8 @@ internal class DefaultPollAggregationProcessor @Inject constructor(
} }
val vote = content.getBestResponse()?.answers?.first() ?: return false val vote = content.getBestResponse()?.answers?.first() ?: return false
if (!targetPollContent.getBestPollCreationInfo()?.answers?.map { it.id }?.contains(vote).orFalse()) { val targetPollContent = getPollContent(session, roomId, targetEventId)
if (targetPollContent != null && !targetPollContent.getBestPollCreationInfo()?.answers?.map { it.id }?.contains(vote).orFalse()) {
return false return false
} }