diff --git a/html/src/app.js b/html/src/app.js index 05907978..24bb8381 100644 --- a/html/src/app.js +++ b/html/src/app.js @@ -12620,6 +12620,9 @@ speechSynthesis.getVoices(); tags.push('~canRequestInvite'); } } + if (D.accessType === 'group' && D.ageGate) { + tags.push('~ageGate'); + } if (D.region === 'US West') { tags.push(`~region(us)`); } else if (D.region === 'US East') { @@ -12746,7 +12749,14 @@ speechSynthesis.getVoices(); params.canRequestInvite = true; } } - if (D.ageGate) { + if ( + D.ageGate && + type === 'group' && + this.hasGroupPermission( + D.groupRef, + 'group-instance-age-gated-create' + ) + ) { params.ageGate = true; } try { diff --git a/html/src/classes/uiComponents.js b/html/src/classes/uiComponents.js index c14fcd7f..24b05afa 100644 --- a/html/src/classes/uiComponents.js +++ b/html/src/classes/uiComponents.js @@ -440,6 +440,10 @@ export default class extends baseClass { ); } this.isAgeGated = this.instance.ageGate === true; + if (this.location && this.location.includes('~ageGate')) { + // dumb workaround for API not returning `ageGate` + this.isAgeGated = true; + } }, showUserDialog(userId) { API.$emit('SHOW_USER_DIALOG', userId); diff --git a/html/src/classes/utils.js b/html/src/classes/utils.js index 4518d011..d704f9aa 100644 --- a/html/src/classes/utils.js +++ b/html/src/classes/utils.js @@ -105,7 +105,8 @@ export default { groupId: null, groupAccessType: null, canRequestInvite: false, - strict: false + strict: false, + ageGate: false }; if (_tag === 'offline' || _tag === 'offline:offline') { ctx.isOffline = true; @@ -149,6 +150,8 @@ export default { ctx.groupAccessType = value; } else if (key === 'strict') { ctx.strict = true; + } else if (key === 'ageGate') { + ctx.ageGate = true; } } else { ctx.instanceName = s; diff --git a/html/src/mixins/dialogs/newInstance.pug b/html/src/mixins/dialogs/newInstance.pug index 0449fc3f..78891b1d 100644 --- a/html/src/mixins/dialogs/newInstance.pug +++ b/html/src/mixins/dialogs/newInstance.pug @@ -24,8 +24,8 @@ mixin newInstance() el-radio-button(label="Japan") {{ $t('dialog.new_instance.region_jp') }} el-form-item(:label="$t('dialog.new_instance.queueEnabled')" v-if="newInstanceDialog.accessType === 'group'") el-checkbox(v-model="newInstanceDialog.queueEnabled" @change="buildInstance") - el-form-item(:label="$t('dialog.new_instance.ageGate')") - el-checkbox(v-model="newInstanceDialog.ageGate" @change="buildInstance") + el-form-item(:label="$t('dialog.new_instance.ageGate')" v-if="newInstanceDialog.accessType === 'group'") + el-checkbox(v-model="newInstanceDialog.ageGate" @change="buildInstance" :disabled="!hasGroupPermission(newInstanceDialog.groupRef, 'group-instance-age-gated-create')") el-form-item(:label="$t('dialog.new_instance.world_id')") el-input(v-model="newInstanceDialog.worldId" size="mini" @click.native="$event.target.tagName === 'INPUT' && $event.target.select()" @change="buildInstance") el-form-item(:label="$t('dialog.new_instance.group_id')" v-if="newInstanceDialog.accessType === 'group'") @@ -70,6 +70,8 @@ mixin newInstance() el-radio-button(label="US East") {{ $t('dialog.new_instance.region_use') }} el-radio-button(label="Europe") {{ $t('dialog.new_instance.region_eu') }} el-radio-button(label="Japan") {{ $t('dialog.new_instance.region_jp') }} + el-form-item(:label="$t('dialog.new_instance.ageGate')" v-if="newInstanceDialog.accessType === 'group'") + el-checkbox(v-model="newInstanceDialog.ageGate" @change="buildInstance") el-form-item(:label="$t('dialog.new_instance.world_id')") el-input(v-model="newInstanceDialog.worldId" size="mini" @click.native="$event.target.tagName === 'INPUT' && $event.target.select()" @change="buildLegacyInstance") el-form-item(:label="$t('dialog.new_instance.instance_id')")