diff --git a/html/src/app.js b/html/src/app.js index 622e2d4d..3691b765 100644 --- a/html/src/app.js +++ b/html/src/app.js @@ -1421,6 +1421,9 @@ speechSynthesis.getVoices(); $trustColor: 'x-tag-untrusted', $trustSortNum: 1, $languages: [], + $joinCount: 0, + $timeSpent: 0, + $lastSeen: '', // ...json }; @@ -1862,10 +1865,7 @@ speechSynthesis.getVoices(); var {json} = args; var D = $app.userDialog; if ($app.userDialog.visible && D.ref.location === json.id) { - D.instance = { - id: json.id, - occupants: json.n_users - }; + D.instance.occupants = json.n_users; } }); @@ -7033,10 +7033,7 @@ speechSynthesis.getVoices(); joinTime: Date.parse(ctx.created_at) }; this.lastLocation.playerList.set(ctx.displayName, userMap); - if ( - this.friends.has(ctx.userId) || - API.currentUser.displayName === ctx.displayName - ) { + if (this.friends.has(ctx.userId)) { this.lastLocation.friendList.set( ctx.displayName, userMap @@ -7562,10 +7559,7 @@ speechSynthesis.getVoices(); gameLog.userDisplayName, userMap ); - if ( - this.friends.has(userId) || - API.currentUser.displayName === gameLog.userDisplayName - ) { + if (this.friends.has(userId)) { this.lastLocation.friendList.set( gameLog.userDisplayName, userMap @@ -10429,7 +10423,11 @@ speechSynthesis.getVoices(); D.loading = true; D.avatars = []; D.worlds = []; - D.instance = {}; + D.instance = { + id: '', + occupants: 0, + friendCount: 0 + }; D.lastSeen = ''; D.joinCount = 0; D.timeSpent = ''; @@ -10551,6 +10549,7 @@ speechSynthesis.getVoices(); } } var users = []; + var friendCount = 0; var playersInInstance = this.lastLocation.playerList; if ( this.lastLocation.location === L.tag && @@ -10578,6 +10577,7 @@ speechSynthesis.getVoices(); users.push(API.cachedUsers.get(friend.userId)); } } + friendCount = users.length - 1; } else if (L.isOffline === false) { for (var friend of this.friends.values()) { if ( @@ -10593,6 +10593,7 @@ speechSynthesis.getVoices(); users.push(friend.ref); } } + friendCount = users.length; } users.sort(compareByLocationAt); D.users = users; @@ -10608,6 +10609,7 @@ speechSynthesis.getVoices(); occupants: 0 }; } + D.instance.friendCount = friendCount; }; $app.methods.setUserDialogWorlds = function (userId) { @@ -11178,6 +11180,7 @@ speechSynthesis.getVoices(); instances[id] = { id, occupants, + friendCount: 0, users: [] }; } @@ -11186,15 +11189,18 @@ speechSynthesis.getVoices(); instances[instanceId] = { id: instanceId, occupants: 0, + friendCount: 0, users: [] }; } var lastLocation$ = API.parseLocation(this.lastLocation.location); var playersInInstance = this.lastLocation.playerList; if (lastLocation$.worldId === D.id) { + var friendsInInstance = this.lastLocation.friendList; var instance = { id: lastLocation$.instanceId, occupants: playersInInstance.size, + friendCount: friendsInInstance.size, users: [] }; instances[instance.id] = instance; @@ -11205,7 +11211,6 @@ speechSynthesis.getVoices(); if (playersInInstance.has(ref.displayName)) { instance.users.push(ref); // add self } - var friendsInInstance = this.lastLocation.friendList; for (var friend of friendsInInstance.values()) { // if friend isn't in instance add them var addUser = true; @@ -11239,6 +11244,7 @@ speechSynthesis.getVoices(); instance = { id: instanceId, occupants: 0, + friendCount: 0, users: [] }; instances[instanceId] = instance; @@ -11265,6 +11271,7 @@ speechSynthesis.getVoices(); L.user = ref; } } + instance.friendCount = instance.users.length; instance.users.sort(compareByLocationAt); rooms.push(instance); } diff --git a/html/src/index.pug b/html/src/index.pug index 7fd1e0da..8981f9b8 100644 --- a/html/src/index.pug +++ b/html/src/index.pug @@ -1210,7 +1210,7 @@ html el-button(v-if="copyLocationCheck(userDialog.ref.location)" @click="copyLocation(userDialog.ref.location)" size="mini" icon="el-icon-s-order" style="margin-left:5px" circle) el-tooltip(placement="top" content="Refresh player count" :disabled="hideTooltips") el-button(@click="refreshInstancePlayerCount(userDialog.ref.location)" 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.users.length > 0") ({{ userDialog.users.length }})] + span(v-if="userDialog.instance.occupants" style="margin-left:5px") {{ userDialog.instance.occupants }} #[template(v-if="userDialog.instance.friendCount > 0") ({{ userDialog.instance.friendCount }})] .x-friend-list(style="flex:1;margin-top:10px") .x-friend-item(v-if="userDialog.$location.userId" @click="showUserDialog(userDialog.$location.userId)") template(v-if="userDialog.$location.user") @@ -1411,7 +1411,7 @@ html el-button(v-if="copyLocationCheck(room.$location.tag)" @click="copyLocation(room.$location.tag)" size="mini" icon="el-icon-s-order" style="margin-left:5px" circle) el-tooltip(placement="top" content="Refresh player count" :disabled="hideTooltips") el-button(@click="refreshInstancePlayerCount(room.$location.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.users.length > 0") ({{ room.users.length }})] + span(v-if="room.occupants" style="margin-left:5px") {{ room.occupants }} #[template(v-if="room.friendCount > 0") ({{ room.friendCount }})] .x-friend-list(style="margin:10px 0" v-if="room.$location.userId || room.users.length") .x-friend-item(v-if="room.$location.userId" @click="showUserDialog(room.$location.userId)") template(v-if="room.$location.user")