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

feat(JitsiConference): Separate conference name validation errors. #2466

Closed
Closed
Changes from 1 commit
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
27 changes: 16 additions & 11 deletions JitsiConference.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,21 +131,26 @@ function _getCodecMimeType(codec) {
* and so on...
*/
export default function JitsiConference(options) {
if (!options.name || options.name.toLowerCase() !== options.name.toString()) {
const errmsg
= 'Invalid conference name (no conference name passed or it '
+ 'contains invalid characters like capital letters)!';
const additionalLogMsg = options.name
? `roomName=${options.name}; condition - ${options.name.toLowerCase()}!==${options.name.toString()}`
: 'No room name passed!';

logger.error(`${errmsg} ${additionalLogMsg}`);
const name = options.name;

// Conference name validation
if (!name) {
const errmsg = 'Invalid conference name (no conference name passed)!';

logger.error(`${errmsg} No room name passed!`);
throw new Error(errmsg);
}
if (name.toLowerCase() !== name.toString()) {
const errmsg = 'Invalid conference name (it contains invalid characters like capital letters)!';

logger.error(`${errmsg} roomName=${name}; condition - ${name.toLowerCase()}!==${name.toString()}`);
throw new Error(errmsg);
}

this.connection = options.connection;
this.xmpp = this.connection?.xmpp;

if (this.xmpp.isRoomCreated(options.name, options.customDomain)) {
if (this.xmpp.isRoomCreated(name, options.customDomain)) {
const errmsg = 'A conference with the same name has already been created!';

delete this.connection;
Expand Down Expand Up @@ -476,7 +481,7 @@ JitsiConference.prototype._init = function(options = {}) {
userName: config.statisticsDisplayName ? config.statisticsDisplayName : this.myUserId(),
confID: config.confID || `${this.connection.options.hosts.domain}/${this.options.name}`,
siteID: config.siteID,
roomName: this.options.name,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you changing this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad that should be roomName. Initially I used roomName = options.name, but then I notice that it is mention as conference name in some places and room name on others so renamed all occurrence and this code was corrupted (

name: this.options.name,
applicationName: config.applicationName
});
Statistics.analytics.addPermanentProperties({
Expand Down
Loading