Code review fix.

This commit is contained in:
Onuray Sahin 2023-01-10 19:22:56 +03:00
parent ec27c67940
commit 8495536fd3
1 changed files with 14 additions and 10 deletions

View File

@ -50,18 +50,22 @@ class PollResponseDataFactory @Inject constructor(
}
private fun getPollResponseSummary(event: TimelineEvent): PollResponseAggregatedSummary? {
if (event.root.isPollEnd()) {
val pollStartEventId = event.root.getRelationContent()?.eventId ?: return null.also {
return if (event.root.isPollEnd()) {
val pollStartEventId = event.root.getRelationContent()?.eventId
if (pollStartEventId.isNullOrEmpty()) {
Timber.e("### Cannot render poll end event because poll start event id is null")
null
} else {
activeSessionHolder
.getSafeActiveSession()
?.roomService()
?.getRoom(event.roomId)
?.getTimelineEvent(pollStartEventId)
?.annotations
?.pollResponseSummary
}
return activeSessionHolder
.getSafeActiveSession()
?.roomService()
?.getRoom(event.roomId)
?.getTimelineEvent(pollStartEventId)
?.annotations
?.pollResponseSummary
} else {
event.annotations?.pollResponseSummary
}
return event.annotations?.pollResponseSummary
}
}