Merge pull request #20483 from GuiLeme/fix-caption-locale-subscription

fix(html5): caption subscription error
This commit is contained in:
Gustavo Trott 2024-06-14 16:53:22 -03:00 committed by GitHub
commit 6984763da7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 25 additions and 19 deletions

View File

@ -4,6 +4,7 @@ import org.bigbluebutton.common2.msgs._
import org.bigbluebutton.core.models.{ UserState, Users2x }
import org.bigbluebutton.core.running.{ LiveMeeting, OutMsgRouter }
import org.bigbluebutton.core.apps.{ PermissionCheck, RightsManagementTrait }
import org.bigbluebutton.core.db.{ CaptionLocaleDAO, CaptionTypes }
import org.bigbluebutton.core.domain.MeetingState2x
trait SetUserSpeechLocaleMsgHdlr extends RightsManagementTrait {
@ -34,6 +35,12 @@ trait SetUserSpeechLocaleMsgHdlr extends RightsManagementTrait {
} yield {
var changeLocale: Option[UserState] = None;
changeLocale = Users2x.setUserSpeechLocale(liveMeeting.users2x, msg.header.userId, msg.body.locale)
// Add new CaptionLocale
CaptionLocaleDAO.insertOrUpdateCaptionLocale(
liveMeeting.props.meetingProp.intId,
msg.body.locale, CaptionTypes.AUDIO_TRANSCRIPTION, msg.header.userId
)
broadcastUserSpeechLocaleChanged(user, msg.body.locale, msg.body.provider)
}

View File

@ -1877,7 +1877,7 @@ SELECT
FLOOR(EXTRACT(EPOCH FROM current_timestamp) * 1000)::bigint AS "currentTimeMillis";
------------------------------------
----audioCaption or typedCaption
----caption
CREATE TABLE "caption_locale" (
"meetingId" varchar(100) NOT NULL REFERENCES "meeting"("meetingId") ON DELETE CASCADE,
@ -2080,10 +2080,5 @@ select "meeting"."meetingId",
select 1
from "v_caption_activeLocales"
where "v_caption_activeLocales"."meetingId" = "meeting"."meetingId"
) or exists (
select 1
from "v_user"
where "v_user"."meetingId" = "meeting"."meetingId"
and NULLIF("speechLocale",'') is not null
)as "hasCaption"
) as "hasCaption"
from "meeting";

View File

@ -87,12 +87,14 @@ const AudioCaptionsSelect: React.FC<AudioCaptionsSelectProps> = ({
const [setSpeechLocaleMutation] = useMutation(SET_SPEECH_LOCALE);
const setUserSpeechLocale = (speechLocale: string, provider: string) => {
setSpeechLocaleMutation({
variables: {
locale: speechLocale,
provider,
},
});
if (speechLocale !== '') {
setSpeechLocaleMutation({
variables: {
locale: speechLocale,
provider,
},
});
}
};
if (!isTranscriptionEnabled || useLocaleHook) return null;

View File

@ -66,12 +66,14 @@ const AudioCaptionsSpeech: React.FC<AudioCaptionsSpeechProps> = ({
const [setSpeechLocaleMutation] = useMutation(SET_SPEECH_LOCALE);
const setUserSpeechLocale = (speechLocale: string, provider: string) => {
setSpeechLocaleMutation({
variables: {
locale: speechLocale,
provider,
},
});
if (speechLocale !== '') {
setSpeechLocaleMutation({
variables: {
locale: speechLocale,
provider,
},
});
}
};
const setDefaultLocale = () => {