Bug fixes and small changes

This commit is contained in:
Natsumi
2021-04-20 23:32:38 +12:00
parent 534c14abe8
commit 2946c9f6ad
3 changed files with 58 additions and 60 deletions
+43 -51
View File
@@ -3712,7 +3712,7 @@ speechSynthesis.getVoices();
try { try {
if (API.isLoggedIn === true) { if (API.isLoggedIn === true) {
if (--this.nextCurrentUserRefresh <= 0) { if (--this.nextCurrentUserRefresh <= 0) {
this.nextCurrentUserRefresh = 120; // 1min this.nextCurrentUserRefresh = 60; // 30secs
API.getCurrentUser().catch((err1) => { API.getCurrentUser().catch((err1) => {
throw err1; throw err1;
}); });
@@ -4415,7 +4415,7 @@ speechSynthesis.getVoices();
}; };
$app.methods.displayXSNotification = async function (noty, message, image) { $app.methods.displayXSNotification = async function (noty, message, image) {
var timeout = parseInt(this.notificationTimeout) / 1000; var timeout = parseInt(parseInt(this.notificationTimeout) / 1000);
switch (noty.type) { switch (noty.type) {
case 'OnPlayerJoined': case 'OnPlayerJoined':
AppApi.XSNotification('VRCX', `${noty.data} has joined`, timeout, image); AppApi.XSNotification('VRCX', `${noty.data} has joined`, timeout, image);
@@ -7743,9 +7743,13 @@ speechSynthesis.getVoices();
API.getUser(args.params); API.getUser(args.params);
} }
this.getAvatarName(args); this.getAvatarName(args);
if (D.ref.$location.worldId) { var L = API.parseLocation(D.ref.location);
if ((L.worldId) &&
(this.lastLocation.location !== L.tag) &&
((L.accessType === 'public') ||
(this.friends.has(L.userId)))) {
API.getWorld({ API.getWorld({
worldId: D.ref.$location.worldId worldId: L.worldId
}); });
} }
} }
@@ -7919,12 +7923,15 @@ speechSynthesis.getVoices();
}); });
}; };
$app.methods.refreshUserDialogAvatars = function () { $app.methods.refreshUserDialogAvatars = function (fileId) {
var D = this.userDialog; var D = this.userDialog;
if (D.isAvatarsLoading) { if (D.isAvatarsLoading) {
return; return;
} }
D.isAvatarsLoading = true; D.isAvatarsLoading = true;
if (fileId) {
D.loading = true;
}
var params = { var params = {
n: 50, n: 50,
offset: 0, offset: 0,
@@ -7955,6 +7962,19 @@ speechSynthesis.getVoices();
var array = Array.from(map.values()); var array = Array.from(map.values());
this.setUserDialogAvatars(array); this.setUserDialogAvatars(array);
D.isAvatarsLoading = false; D.isAvatarsLoading = false;
if (fileId) {
D.loading = false;
for (var ref of array) {
if (extractFileId(ref.imageUrl) === fileId) {
this.showAvatarDialog(ref.id);
return;
}
}
this.$message({
message: 'Own avatar not found',
type: 'error'
});
}
} }
}); });
}; };
@@ -8099,43 +8119,7 @@ speechSynthesis.getVoices();
}); });
} else if (command === 'Show Avatar Author') { } else if (command === 'Show Avatar Author') {
var { currentAvatarImageUrl } = D.ref; var { currentAvatarImageUrl } = D.ref;
for (var ref of API.cachedAvatars.values()) { this.showAvatarAuthorDialog(D.id, currentAvatarImageUrl)
if (ref.imageUrl === currentAvatarImageUrl) {
this.showAvatarDialog(ref.id);
return;
}
}
var fileId = extractFileId(currentAvatarImageUrl);
if (fileId) {
if (API.cachedAvatarNames.has(fileId)) {
var { ownerId } = API.cachedAvatarNames.get(fileId);
if (ownerId === D.id) {
this.$message({
message: 'It\'s personal (own) avatar',
type: 'warning'
});
return;
}
this.showUserDialog(ownerId);
} else {
API.getAvatarImages({fileId}).then((args) => {
var ownerId = args.json.ownerId;
if (ownerId === D.id) {
this.$message({
message: 'It\'s personal (own) avatar',
type: 'warning'
});
return;
}
this.showUserDialog(ownerId);
});
}
} else {
this.$message({
message: 'Sorry, the author is unknown',
type: 'error'
});
}
} else if (command === 'Show Fallback Avatar Details') { } else if (command === 'Show Fallback Avatar Details') {
var { fallbackAvatar } = D.ref; var { fallbackAvatar } = D.ref;
if (fallbackAvatar) { if (fallbackAvatar) {
@@ -8710,16 +8694,30 @@ speechSynthesis.getVoices();
}; };
$app.methods.showAvatarAuthorDialog = function (refUserId, currentAvatarImageUrl) { $app.methods.showAvatarAuthorDialog = function (refUserId, currentAvatarImageUrl) {
var fileId = extractFileId(currentAvatarImageUrl);
if (!fileId) {
this.$message({
message: 'Sorry, the author is unknown',
type: 'error'
});
return;
}
if (refUserId === API.currentUser.id) {
this.showAvatarDialog(API.currentUser.currentAvatar);
return;
}
for (var ref of API.cachedAvatars.values()) { for (var ref of API.cachedAvatars.values()) {
if (ref.imageUrl === currentAvatarImageUrl) { if (extractFileId(ref.imageUrl) === fileId) {
this.showAvatarDialog(ref.id); this.showAvatarDialog(ref.id);
return; return;
} }
} }
var fileId = extractFileId(currentAvatarImageUrl);
if (fileId) {
if (API.cachedAvatarNames.has(fileId)) { if (API.cachedAvatarNames.has(fileId)) {
var { ownerId } = API.cachedAvatarNames.get(fileId); var { ownerId } = API.cachedAvatarNames.get(fileId);
if (ownerId === API.currentUser.id) {
this.refreshUserDialogAvatars(fileId);
return;
}
if (ownerId === refUserId) { if (ownerId === refUserId) {
this.$message({ this.$message({
message: 'It\'s personal (own) avatar', message: 'It\'s personal (own) avatar',
@@ -8741,12 +8739,6 @@ speechSynthesis.getVoices();
this.showUserDialog(ownerId); this.showUserDialog(ownerId);
}); });
} }
} else {
this.$message({
message: 'Sorry, the author is unknown',
type: 'error'
});
}
}; };
$app.methods.refreshAvatarDialogTreeData = function () { $app.methods.refreshAvatarDialogTreeData = function () {
+1
View File
@@ -1083,6 +1083,7 @@ html
el-tab-pane(label="Avatars") el-tab-pane(label="Avatars")
template(v-if="userDialog.ref.id === API.currentUser.id") template(v-if="userDialog.ref.id === API.currentUser.id")
el-button(type="default" :loading="userDialog.isAvatarsLoading" @click="refreshUserDialogAvatars()" size="mini" icon="el-icon-refresh" circle) el-button(type="default" :loading="userDialog.isAvatarsLoading" @click="refreshUserDialogAvatars()" size="mini" icon="el-icon-refresh" circle)
template(v-if="userDialogAvatars.length > 0")
span(style="margin-left:5px") Total {{ userDialogAvatars.length }} span(style="margin-left:5px") Total {{ userDialogAvatars.length }}
el-radio-group(v-model="userDialog.avatarSorting" size="mini" style="margin-left:30px" @change="changeUserDialogAvatarSorting") el-radio-group(v-model="userDialog.avatarSorting" size="mini" style="margin-left:30px" @change="changeUserDialogAvatarSorting")
el-radio(label="name") by name el-radio(label="name") by name
+5
View File
@@ -262,6 +262,11 @@ html
span {{ device[2] }}% span {{ device[2] }}%
.x-containerbottom .x-containerbottom
template(v-if="lastLocation.date != 0") template(v-if="lastLocation.date != 0")
template(v-if="config && config.minimalFeed")
span(style="float:right") {{ lastLocationTimer }}
span(style="display:inline-block") {{ lastLocation.playerList.length }}
span(style="display:inline-block;font-weight:bold") {{ lastLocation.friendList.length !== 0 ? ` (${lastLocation.friendList.length})` : ''}}
template(v-else)
span(style="float:right") Timer: {{ lastLocationTimer }} span(style="float:right") Timer: {{ lastLocationTimer }}
span(style="display:inline-block") Players: {{ lastLocation.playerList.length }} span(style="display:inline-block") Players: {{ lastLocation.playerList.length }}
span(style="display:inline-block;font-weight:bold") {{ lastLocation.friendList.length !== 0 ? ` (${lastLocation.friendList.length})` : ''}} span(style="display:inline-block;font-weight:bold") {{ lastLocation.friendList.length !== 0 ? ` (${lastLocation.friendList.length})` : ''}}