Skip to content

Commit

Permalink
ref: Move hasTranscriber out of the detector. (#1173)
Browse files Browse the repository at this point in the history
  • Loading branch information
bgrozev authored Sep 26, 2024
1 parent f0a8cc4 commit eb53e19
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import org.jitsi.jicofo.JicofoConfig
import org.jitsi.jicofo.metrics.JicofoMetricsContainer
import org.jitsi.jicofo.xmpp.BaseBrewery
import org.jitsi.jicofo.xmpp.XmppProvider
import org.jitsi.jicofo.xmpp.muc.ChatRoom
import org.jitsi.utils.OrderedJsonObject
import org.jitsi.utils.logging2.createLogger
import org.jitsi.xmpp.extensions.colibri.ColibriStatsExtension
Expand Down Expand Up @@ -98,11 +97,6 @@ open class JigasiDetector(
transcriberCount.set(getInstanceCount { it.supportsTranscription() }.toLong())
}

fun hasTranscriber(chatRoom: ChatRoom?): Boolean {
return chatRoom?.members?.any { member -> member.isTranscriber }
?: false
}

/**
* The companion object is necessary for the implicit call to this.createLogger() in the super constructor!
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class JigasiIqHandler(
exclude: List<Jid> = emptyList()
) {
val selector = if (request.iq.destination == "jitsi_meet_transcribe") {
if (jigasiDetector.hasTranscriber(conference.chatRoom)) {
if (conference.hasTranscriber()) {
logger.warn("Request failed, transcriber already available: ${request.iq.toStringOpt()}")
IQ.createErrorResponse(
request.iq,
Expand Down Expand Up @@ -256,3 +256,5 @@ class JigasiIqHandler(
}
}
}

private fun JitsiMeetConference.hasTranscriber(): Boolean = this.chatRoom?.members?.any { it.isTranscriber } ?: false

0 comments on commit eb53e19

Please sign in to comment.