diff --git a/html/src/app.js b/html/src/app.js index e5f48351..fccbc83b 100644 --- a/html/src/app.js +++ b/html/src/app.js @@ -2299,6 +2299,10 @@ speechSynthesis.getVoices(); var D = $app.userDialog; if ($app.userDialog.visible && D.ref.$location.tag === json.id) { D.instance.occupants = json.n_users; + D.instance.full = + typeof json.hasCapacityForYou !== 'undefined' && + !json.hasCapacityForYou; + D.instance.json = json; } }); @@ -2312,6 +2316,10 @@ speechSynthesis.getVoices(); for (var instance of D.rooms) { if (instance.id === json.instanceId) { instance.occupants = json.n_users; + instance.full = + typeof json.hasCapacityForYou !== 'undefined' && + !json.hasCapacityForYou; + instance.json = json; break; } } @@ -2328,6 +2336,10 @@ speechSynthesis.getVoices(); for (var instance of D.instances) { if (instance.id === json.instanceId) { instance.occupants = json.n_users; + instance.full = + typeof json.hasCapacityForYou !== 'undefined' && + !json.hasCapacityForYou; + instance.json = json; break; } } @@ -14969,8 +14981,14 @@ speechSynthesis.getVoices(); D.worlds = []; D.instance = { id: '', + tag: '', + $location: {}, occupants: 0, - friendCount: 0 + friendCount: 0, + full: false, + users: [], + shortName: '', + json: {} }; D.representedGroup = { bannerUrl: '', @@ -15263,14 +15281,27 @@ speechSynthesis.getVoices(); playersInInstance.size > 0 ) { D.instance = { - id: L.tag, - occupants: this.lastLocation.playerList.size + id: L.instanceId, + tag: L.tag, + $location: L, + occupants: this.lastLocation.playerList.size, + friendCount: 0, + full: false, + users: [], + shortName: '', + json: {} }; } if (L.isOffline || L.isPrivate || L.isTraveling || L.worldId === '') { D.instance = { - id: L.tag, - occupants: 0 + id: L.instanceId, + tag: L.tag, + $location: L, + occupants: 0, + full: false, + users: [], + shortName: '', + json: {} }; } D.instance.friendCount = friendCount; @@ -16131,7 +16162,11 @@ speechSynthesis.getVoices(); D.ref = ref; $app.applyWorldDialogInstances(); for (var room of D.rooms) { - if (room.occupants === 0) { + if ( + $app.isRealInstance(room.tag) && + room.tag !== $app.lastLocation.location && + (room.$location.accessType !== 'public' || room.occupants === 0) + ) { API.getInstance({ worldId: D.id, instanceId: room.id @@ -16311,19 +16346,27 @@ speechSynthesis.getVoices(); for (var [id, occupants] of D.ref.instances) { instances[id] = { id, + tag: `${D.id}:${id}`, occupants, friendCount: 0, - users: [] + full: false, + users: [], + shortName: '', + json: {} }; } var {instanceId, shortName} = D.$location; if (instanceId && typeof instances[instanceId] === 'undefined') { instances[instanceId] = { id: instanceId, + tag: `${D.id}:${instanceId}`, + $location: {}, occupants: 0, friendCount: 0, + full: false, + users: [], shortName, - users: [] + json: {} }; } var currentLocation = this.lastLocation.location; @@ -16336,9 +16379,14 @@ speechSynthesis.getVoices(); var friendsInInstance = this.lastLocation.friendList; var instance = { id: lastLocation$.instanceId, + tag: currentLocation, + $location: {}, occupants: playersInInstance.size, friendCount: friendsInInstance.size, - users: [] + full: false, + users: [], + shortName: '', + json: {} }; instances[instance.id] = instance; var ref = API.cachedUsers.get(API.currentUser.id); @@ -16381,9 +16429,14 @@ speechSynthesis.getVoices(); if (typeof instance === 'undefined') { instance = { id: instanceId, + tag: `${D.id}:${instanceId}`, + $location: {}, occupants: 0, friendCount: 0, - users: [] + full: false, + users: [], + shortName: '', + json: {} }; instances[instanceId] = instance; } @@ -16424,10 +16477,16 @@ speechSynthesis.getVoices(); } // reuse instance occupants from getInstance for (var room of rooms) { - if (room.occupants === 0) { + if ( + $app.isRealInstance(room.tag) && + room.tag !== $app.lastLocation.location && + (room.$location.accessType !== 'public' || room.occupants === 0) + ) { for (var instance of D.rooms) { if (instance.id === room.id) { room.occupants = instance.occupants; + room.full = instance.full; + room.json = instance.json; break; } } @@ -16459,9 +16518,13 @@ speechSynthesis.getVoices(); instances[instance.location] = { id: instance.instanceId, tag: instance.location, + $location: {}, occupants: instance.memberCount, friendCount: 0, - users: [] + full: false, + users: [], + shortName: '', + json: {} }; } } @@ -16476,9 +16539,13 @@ speechSynthesis.getVoices(); var instance = { id: lastLocation$.instanceId, tag: currentLocation, + $location: {}, occupants: playersInInstance.size, friendCount: friendsInInstance.size, - users: [] + full: false, + users: [], + shortName: '', + json: {} }; instances[currentLocation] = instance; var ref = API.cachedUsers.get(API.currentUser.id); @@ -16522,9 +16589,13 @@ speechSynthesis.getVoices(); instance = { id: instanceId, tag, + $location: {}, occupants: 0, friendCount: 0, - users: [] + full: false, + users: [], + shortName: '', + json: {} }; instances[tag] = instance; } diff --git a/html/src/index.pug b/html/src/index.pug index ac9b7793..a8a2bde1 100644 --- a/html/src/index.pug +++ b/html/src/index.pug @@ -1773,10 +1773,11 @@ html el-tooltip(placement="top" :content="$t('dialog.user.info.launch_invite_tooltip')" :disabled="hideTooltips") launch(:location="userDialog.$location.tag" style="margin-left:5px") el-tooltip(placement="top" :content="$t('dialog.user.info.self_invite_tooltip')" :disabled="hideTooltips") - invite-yourself(:location="userDialog.$location.tag" :shortname="userDialog.$location.shortName" style="margin-left:5px") + invite-yourself(:location="userDialog.$location.tag" :shortname="userDialog.$location.shortName" style="margin-left:5px" :disabled="typeof userDialog.instance.json.canRequestInvite !== 'undefined' && !userDialog.instance.json.canRequestInvite") el-tooltip(placement="top" :content="$t('dialog.user.info.refresh_user_count_tooltip')" :disabled="hideTooltips") el-button(v-if="userDialog.$location.tag !== lastLocation.location" @click="refreshInstancePlayerCount(userDialog.$location.tag)" size="mini" icon="el-icon-refresh" style="margin-left:5px" circle) span(v-if="userDialog.instance.occupants" style="margin-left:5px") {{ userDialog.instance.occupants }} #[template(v-if="userDialog.instance.friendCount > 0") ({{ userDialog.instance.friendCount }})] + span(v-if="userDialog.instance.full" style="margin-left:5px;color:lightcoral") {{ $t('dialog.user.info.instance_full') }} .x-friend-list(style="flex:1;margin-top:10px;max-height:150px") .x-friend-item(v-if="userDialog.$location.userId" @click="showUserDialog(userDialog.$location.userId)" class="x-friend-item-border") template(v-if="userDialog.$location.user") @@ -2065,10 +2066,11 @@ html div(style="margin:5px 0") location-world(:locationobject="room.$location" :currentuserid="API.currentUser.id" :worlddialogshortname="worldDialog.$location.shortName") el-tooltip(placement="top" :content="$t('dialog.world.instances.self_invite_tooltip')" :disabled="hideTooltips") - invite-yourself(:location="room.$location.tag" :shortname="room.$location.shortName" style="margin-left:5px") + invite-yourself(:location="room.$location.tag" :shortname="room.$location.shortName" style="margin-left:5px" :disabled="typeof room.json.canRequestInvite !== 'undefined' && !room.json.canRequestInvite") el-tooltip(placement="top" :content="$t('dialog.world.instances.refresh_user_count_tooltip')" :disabled="hideTooltips") - el-button(v-if="room.$location.tag !== lastLocation.location" @click="refreshInstancePlayerCount(room.$location.tag)" size="mini" icon="el-icon-refresh" style="margin-left:5px" circle) + el-button(v-if="room.tag !== lastLocation.location" @click="refreshInstancePlayerCount(room.tag)" size="mini" icon="el-icon-refresh" style="margin-left:5px" circle) span(v-if="room.occupants" style="margin-left:5px") {{ room.occupants }} #[template(v-if="room.friendCount > 0") ({{ room.friendCount }})] + span(v-if="room.full" style="margin-left:5px;color:lightcoral") {{ $t('dialog.world.instances.instance_full') }} .x-friend-list(style="margin:10px 0;max-height:unset" v-if="room.$location.userId || room.users.length") .x-friend-item(v-if="room.$location.userId" @click="showUserDialog(room.$location.userId)" class="x-friend-item-border") template(v-if="room.$location.user") @@ -2369,10 +2371,11 @@ html div(style="margin:5px 0") location(:location="room.tag") el-tooltip(placement="top" content="Invite yourself" :disabled="hideTooltips") - invite-yourself(:location="room.tag" style="margin-left:5px") + invite-yourself(:location="room.tag" style="margin-left:5px" :disabled="typeof room.json.canRequestInvite !== 'undefined' && !room.json.canRequestInvite") el-tooltip(placement="top" content="Refresh player count" :disabled="hideTooltips") el-button(v-if="room.tag !== lastLocation.location" @click="refreshInstancePlayerCount(room.tag)" size="mini" icon="el-icon-refresh" style="margin-left:5px" circle) span(v-if="room.occupants" style="margin-left:5px") {{ room.occupants }} #[template(v-if="room.friendCount > 0") ({{ room.friendCount }})] + span(v-if="room.full" style="margin-left:5px;color:lightcoral") {{ $t('dialog.group.info.instance_full') }} .x-friend-list(style="margin:10px 0;padding:0;max-height:unset" v-if="room.users.length") .x-friend-item(v-for="user in room.users" :key="user.id" @click="showUserDialog(user.id)" class="x-friend-item-border") .avatar(:class="userStatusClass(user)") diff --git a/html/src/localization/strings/en.json b/html/src/localization/strings/en.json index e66f40f5..e67ccfa7 100644 --- a/html/src/localization/strings/en.json +++ b/html/src/localization/strings/en.json @@ -547,7 +547,8 @@ "avatar_cloning_allow": "Allowed", "avatar_cloning_deny": "Deny", "home_location": "Home Location", - "accuracy_notice": "Info from local database may not be accurate" + "accuracy_notice": "Info from local database may not be accurate", + "instance_full": "full" }, "groups": { "header": "Groups", @@ -612,6 +613,7 @@ "capacity_count": "Capacity {count} ({max})", "self_invite_tooltip": "Invite Yourself", "refresh_user_count_tooltip": "Refresh User Count", + "instance_full": "full", "instance_creator": "Instance Creator" }, "info": { @@ -722,6 +724,7 @@ "info": { "header": "Info", "announcement": "Announcement", + "instance_full": "full", "rules": "Rules", "members": "Members", "created_at": "Created At", @@ -732,6 +735,7 @@ "id_tooltip": "Copy ID to clipboard", "joined_at": "Joined At", "roles": "Roles", + "role": "Role:", "role_description": "Description:", "role_updated_at": "Updated At:", "role_created_at": "Created At:",