Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ref: Move hasTranscriber out of the detector. #1173

Merged
merged 1 commit into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading