Solved: Cannot set "subject" in API - getting e.trim() error in Console

I’m attempting to set the subject along with the tile mode and display name for the user, via the API.

api.executeCommands({ 
    displayName: [ userFullName ],
    toggleTileView: [],
    subject: roomName 
})

The subject command is not working. The subject in the room still displays the room name. I am attempting a subject that would be something like “Room 2”.

In the browser console I’m getting:

 [JitsiMeetJS.js] <Object.getGlobalOnErrorHandler>:  UnhandledError: Uncaught TypeError: e.trim is not a function Script: https://jitsi.gbtechlab.com:8443/libs/app.bundle.min.js Line: 24 Column: 88940 StackTrace:  TypeError: e.trim is not a function
    at g (https://jitsi.gbtechlab.com:8443/libs/app.bundle.min.js:24:88940)
    at Object.changeLocalDisplayName (https://jitsi.gbtechlab.com:8443/libs/app.bundle.min.js:122:276031)
    at Object.display-name (https://jitsi.gbtechlab.com:8443/libs/app.bundle.min.js:122:196351)
    at https://jitsi.gbtechlab.com:8443/libs/app.bundle.min.js:122:200650
    at https://jitsi.gbtechlab.com:8443/libs/app.bundle.min.js:44:105979
    at Set.forEach (<anonymous>)
    at l.emit (https://jitsi.gbtechlab.com:8443/libs/app.bundle.min.js:44:105965)
    at l._onMessageReceived (https://jitsi.gbtechlab.com:8443/libs/app.bundle.min.js:44:105747)
    at https://jitsi.gbtechlab.com:8443/libs/app.bundle.min.js:44:105064
    at u (https://jitsi.gbtechlab.com:8443/libs/app.bundle.min.js:155:31466)
Uncaught TypeError: e.trim is not a function
    at g (functions.js:93)
    at Object.changeLocalDisplayName (conference.js:2879)
    at Object.display-name (API.js:82)
    at API.js:348
    at Transport.js:128
    at Set.forEach (<anonymous>)
    at l.emit (Transport.js:127)
    at l._onMessageReceived (Transport.js:98)
    at PostMessageTransportBackend.js:43
    at u (postis.js:55)

I am running the latest Docker, and in order to get the kickParticipant() working via API, I built a jisti-meet instance with modified files that reflect https://github.com/jitsi/jitsi-meet/pull/7691, and am mounting the libs folder into the docker container. I am also embedding Jitsi into an iFrame and am serving the external_api.js locally and have modified it as well to accommodate the kickParticipant command.

The kickParticipant is working great…I just can’t get the subject to change now.

Is the console error relevant? I’ve tried separating out the commands into separate api.executeCommand calls, but no difference. I’m running them after on.('videoConferenceJoined).

This morning when testing using executeCommands and combining all three, the displayName is not being set, but the subject is. It appears to be having a parsing issue with commands including arguments and errors out while not processing the next one. Sometimes it shows the proper displayName but does not change the subject.

toggleTileView is working fine. I have also tried with no difference:

api.executeCommands({ 
    displayName: [ userFullName ],
    toggleTileView: [],
    subject: [ roomName ]
})

When separating out each command, only ‘subject’ is not working. The console message says [modules/xmpp/ChatRoom.js] <onMessage>: Subject is changed to although the value being passed before the command is properly shown in the console.log before the call is made.

Edit: I see now in JitsiConference.js that being the moderator is required. I changed the subject command to run after participantRoleChanged and checked for moderator status in order to execute. Works okay now.