Merge pull request #8070 from vector-im/yostyle/fix_vb_block_recording
This commit is contained in:
commit
3e17c1c4e7
|
@ -0,0 +1,2 @@
|
||||||
|
[Voice Broadcast] We should not be able to start broadcasting if there is already a live broadcast in the Room
|
||||||
|
|
|
@ -49,14 +49,15 @@ class GetVoiceBroadcastStateEventUseCase @Inject constructor(
|
||||||
* Get the most recent event related to the given voice broadcast.
|
* Get the most recent event related to the given voice broadcast.
|
||||||
*/
|
*/
|
||||||
private fun getMostRecentRelatedEvent(room: Room, voiceBroadcast: VoiceBroadcast): VoiceBroadcastEvent? {
|
private fun getMostRecentRelatedEvent(room: Room, voiceBroadcast: VoiceBroadcast): VoiceBroadcastEvent? {
|
||||||
val startedEvent = room.getTimelineEvent(voiceBroadcast.voiceBroadcastId)
|
val startedEvent = room.getTimelineEvent(voiceBroadcast.voiceBroadcastId)?.root
|
||||||
return if (startedEvent?.root?.isRedacted().orTrue()) {
|
return if (startedEvent?.isRedacted().orTrue()) {
|
||||||
null
|
null
|
||||||
} else {
|
} else {
|
||||||
room.timelineService().getTimelineEventsRelatedTo(RelationType.REFERENCE, voiceBroadcast.voiceBroadcastId)
|
room.timelineService().getTimelineEventsRelatedTo(RelationType.REFERENCE, voiceBroadcast.voiceBroadcastId)
|
||||||
.mapNotNull { timelineEvent -> timelineEvent.root.asVoiceBroadcastEvent() }
|
.mapNotNull { timelineEvent -> timelineEvent.root.asVoiceBroadcastEvent() }
|
||||||
.filterNot { it.root.isRedacted() }
|
.filterNot { it.root.isRedacted() }
|
||||||
.maxByOrNull { it.root.originServerTs ?: 0 }
|
.maxByOrNull { it.root.originServerTs ?: 0 }
|
||||||
|
?: startedEvent?.asVoiceBroadcastEvent()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue