mirror of
https://github.com/element-hq/element-android
synced 2024-11-26 19:35:42 +03:00
Merge pull request #7757 from vector-im/fix/mna/poll-end-not-recognized
[Poll] Poll end event is not recognized (PSG-948 and PSG-949)
This commit is contained in:
commit
fe5e4d6830
3 changed files with 4 additions and 5 deletions
1
changelog.d/7753.bugfix
Normal file
1
changelog.d/7753.bugfix
Normal file
|
@ -0,0 +1 @@
|
|||
[Poll] Poll end event is not recognized
|
|
@ -29,7 +29,6 @@ import org.matrix.android.sdk.api.session.room.getTimelineEvent
|
|||
import org.matrix.android.sdk.api.session.room.model.PollSummaryContent
|
||||
import org.matrix.android.sdk.api.session.room.model.VoteInfo
|
||||
import org.matrix.android.sdk.api.session.room.model.VoteSummary
|
||||
import org.matrix.android.sdk.api.session.room.model.message.MessageEndPollContent
|
||||
import org.matrix.android.sdk.api.session.room.model.message.MessagePollContent
|
||||
import org.matrix.android.sdk.api.session.room.model.message.MessagePollResponseContent
|
||||
import org.matrix.android.sdk.api.session.room.powerlevels.PowerLevelsHelper
|
||||
|
@ -78,7 +77,7 @@ class DefaultPollAggregationProcessor @Inject constructor() : PollAggregationPro
|
|||
val content = event.getClearContent()?.toModel<MessagePollResponseContent>() ?: return false
|
||||
val roomId = event.roomId ?: return false
|
||||
val senderId = event.senderId ?: return false
|
||||
val targetEventId = (event.getRelationContent() ?: content.relatesTo)?.eventId ?: return false
|
||||
val targetEventId = event.getRelationContent()?.eventId ?: return false
|
||||
val targetPollContent = getPollContent(session, roomId, targetEventId) ?: return false
|
||||
|
||||
val annotationsSummaryEntity = getAnnotationsSummaryEntity(realm, roomId, targetEventId)
|
||||
|
@ -154,9 +153,8 @@ class DefaultPollAggregationProcessor @Inject constructor() : PollAggregationPro
|
|||
}
|
||||
|
||||
override fun handlePollEndEvent(session: Session, powerLevelsHelper: PowerLevelsHelper, realm: Realm, event: Event): Boolean {
|
||||
val content = event.getClearContent()?.toModel<MessageEndPollContent>() ?: return false
|
||||
val roomId = event.roomId ?: return false
|
||||
val pollEventId = content.relatesTo?.eventId ?: return false
|
||||
val pollEventId = event.getRelationContent()?.eventId ?: return false
|
||||
val pollOwnerId = getPollEvent(session, roomId, pollEventId)?.root?.senderId
|
||||
val isPollOwner = pollOwnerId == event.senderId
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ import org.matrix.android.sdk.test.fakes.FakeRealm
|
|||
import org.matrix.android.sdk.test.fakes.givenEqualTo
|
||||
import org.matrix.android.sdk.test.fakes.givenFindFirst
|
||||
|
||||
class PollAggregationProcessorTest {
|
||||
class DefaultPollAggregationProcessorTest {
|
||||
|
||||
private val pollAggregationProcessor: PollAggregationProcessor = DefaultPollAggregationProcessor()
|
||||
private val realm = FakeRealm()
|
Loading…
Reference in a new issue