Updates and fixes

This commit is contained in:
Natsumi
2024-05-23 21:11:46 +12:00
parent d9bb77d395
commit 55ebcb1ad7
5 changed files with 27 additions and 38 deletions

View File

@@ -1690,6 +1690,10 @@ speechSynthesis.getVoices();
};
API.applyPresenceGroups = function (ref) {
if (!this.currentUserGroupsInit) {
// wait for init before diffing
return;
}
var groups = ref.presence?.groups;
if (!groups) {
console.error('API.applyPresenceGroups: invalid groups', ref);
@@ -1700,14 +1704,6 @@ speechSynthesis.getVoices();
return;
}
if (groups.length !== this.currentUserGroups.size) {
console.log(
`applyPresenceGroups: size old: ${this.currentUserGroups.size} new: ${groups.length}`,
this.currentUserGroups,
groups
);
}
// update group list
for (var groupId of groups) {
if (!this.currentUserGroups.has(groupId)) {
@@ -4427,6 +4423,7 @@ speechSynthesis.getVoices();
}
this.refreshFavoriteItems();
this.refreshFavoriteGroups();
$app.updateLocalFavoriteFriends();
this.isFavoriteLoading = false;
}
});
@@ -24768,10 +24765,10 @@ speechSynthesis.getVoices();
$app.methods.getCurrentUserGroups = async function () {
var args = await API.getGroups({ userId: API.currentUser.id });
API.currentUserGroups.clear();
args.json.forEach((group) => {
for (var group of args.json) {
var ref = API.applyGroup(group);
API.currentUserGroups.set(group.id, ref);
});
}
await API.getGroupPermissions({ userId: API.currentUser.id });
this.saveCurrentUserGroups();
};
@@ -26451,12 +26448,14 @@ speechSynthesis.getVoices();
};
$app.methods.isRealInstance = function (instanceId) {
if (!instanceId) {
return false;
}
switch (instanceId) {
case 'offline':
case 'private':
case 'traveling':
case instanceId.startsWith('local'):
case '':
return false;
}
return true;
@@ -27898,7 +27897,7 @@ speechSynthesis.getVoices();
this.localFavoriteFriends.clear();
for (var ref of API.cachedFavorites.values()) {
if (
ref.$isDeleted === false &&
!ref.$isDeleted &&
ref.type === 'friend' &&
(this.localFavoriteFriendsGroups.length === 0 ||
this.localFavoriteFriendsGroups.includes(ref.$groupKey))
@@ -29790,7 +29789,6 @@ speechSynthesis.getVoices();
API.currentUserGroups.set(group.id, ref);
}
var fetchedRoles = false;
if (groups) {
for (var i = 0; i < groups.length; i++) {
var groupId = groups[i];
@@ -29809,7 +29807,6 @@ speechSynthesis.getVoices();
});
var ref = API.applyGroup(args.json);
API.currentUserGroups.set(groupId, ref);
fetchedRoles = true;
console.log(`Fetched group ${ref.name}`);
} catch (err) {
console.error(err);
@@ -29818,9 +29815,6 @@ speechSynthesis.getVoices();
}
this.currentUserGroupsInit = true;
if (fetchedRoles) {
this.saveCurrentUserGroups();
}
};
API.applyGroupMember = function (json) {
@@ -30189,23 +30183,18 @@ speechSynthesis.getVoices();
// ignore this event if we were the one to trigger it
return;
}
// if (this.groupDialog.visible && this.groupDialog.id === groupId) {
// this.showGroupDialog(groupId);
// }
if (!API.currentUserGroups.has(groupId)) {
API.currentUserGroups.set(groupId, {
id: groupId,
name: '',
iconUrl: ''
});
if (this.friendLogInitStatus) {
API.getGroup({ groupId, includeRoles: true }).then((args) => {
var ref = API.applyGroup(args.json);
API.currentUserGroups.set(groupId, ref);
this.saveCurrentUserGroups();
return args;
});
}
API.getGroup({ groupId, includeRoles: true }).then((args) => {
var ref = API.applyGroup(args.json);
API.currentUserGroups.set(groupId, ref);
this.saveCurrentUserGroups();
return args;
});
}
};

View File

@@ -983,17 +983,17 @@ html
.group-description(style="margin-top:5px")
span(v-show="groupDialog.ref.name !== groupDialog.ref.description" v-text="groupDialog.ref.description" style="font-size:12px")
div(style="flex:none;margin-left:10px")
template(v-if="groupDialog.inGroup")
el-tooltip(v-if="groupDialog.ref.isRepresenting" placement="top" :content="$t('dialog.group.actions.unrepresent_tooltip')" :disabled="hideTooltips")
template(v-if="groupDialog.inGroup && groupDialog.ref?.myMember")
el-tooltip(v-if="groupDialog.ref.myMember?.isRepresenting" placement="top" :content="$t('dialog.group.actions.unrepresent_tooltip')" :disabled="hideTooltips")
el-button(type="warning" icon="el-icon-star-on" circle @click="clearGroupRepresentation(groupDialog.id)" style="margin-left:5px")
el-tooltip(v-else placement="top" :content="$t('dialog.group.actions.represent_tooltip')" :disabled="hideTooltips")
span
el-button(type="default" icon="el-icon-star-off" circle @click="setGroupRepresentation(groupDialog.id)" style="margin-left:5px" :disabled="groupDialog.ref.privacy === 'private'")
template(v-else-if="groupDialog.ref.membershipStatus === 'requested'")
template(v-else-if="groupDialog.ref.myMember?.membershipStatus === 'requested'")
el-tooltip(placement="top" :content="$t('dialog.group.actions.cancel_join_request_tooltip')" :disabled="hideTooltips")
span
el-button(type="default" icon="el-icon-close" circle @click="cancelGroupRequest(groupDialog.id)" style="margin-left:5px")
template(v-else-if="groupDialog.ref.membershipStatus === 'invited'")
template(v-else-if="groupDialog.ref.myMember?.membershipStatus === 'invited'")
el-tooltip(placement="top" :content="$t('dialog.group.actions.pending_request_tooltip')" :disabled="hideTooltips")
span
el-button(type="default" icon="el-icon-check" circle @click="joinGroup(groupDialog.id)" style="margin-left:5px")
@@ -1395,7 +1395,7 @@ html
el-input(v-for="(link, index) in bioDialog.bioLinks" :key="index" :value="link" v-model="bioDialog.bioLinks[index]" size="small" style="margin-top:5px")
img(slot="prepend" :src="getFaviconUrl(link)" style="width:16px;height:16px")
el-button(slot="append" icon="el-icon-delete" @click="bioDialog.bioLinks.splice(index, 1)")
el-button(@click="bioDialog.bioLinks.push('')" size="mini" style="margin-top:5px") {{ $t('dialog.bio.add_link') }}
el-button(@click="bioDialog.bioLinks.push('')" :disabled="bioDialog.bioLinks.length >= 3" size="mini" style="margin-top:5px") {{ $t('dialog.bio.add_link') }}
template(#footer)
el-button(type="primary" size="small" :disabled="bioDialog.loading" @click="saveBio") {{ $t('dialog.bio.update') }}

View File

@@ -40,7 +40,7 @@ mixin loginPage()
div.x-legal-notice-container
div(style="text-align:center;font-size:12px")
p #[a.x-link(@click="openExternalLink('https://vrchat.com/home/password')") {{ $t("view.login.forgotPassword") }}]
p &copy; 2019-2022 #[a.x-link(@click="openExternalLink('https://github.com/pypy-vrc')") pypy] &amp; #[a.x-link(@click="openExternalLink('https://github.com/Natsumi-sama')") Natsumi]
p &copy; 2019-2024 #[a.x-link(@click="openExternalLink('https://github.com/pypy-vrc')") pypy] &amp; #[a.x-link(@click="openExternalLink('https://github.com/Natsumi-sama')") Natsumi]
p {{ $t("view.settings.general.legal_notice.info") }}
p {{ $t("view.settings.general.legal_notice.disclaimer1") }}
p {{ $t("view.settings.general.legal_notice.disclaimer2") }}

View File

@@ -2158,7 +2158,7 @@ class Database {
);
}
async getAvatarHistory(currentUserId) {
async getAvatarHistory(currentUserId, limit = 100) {
var data = [];
await sqliteService.execute((dbRow) => {
var row = {
@@ -2175,7 +2175,7 @@ class Database {
version: dbRow[13]
};
data.push(row);
}, `SELECT * FROM ${Database.userPrefix}_avatar_history INNER JOIN cache_avatar ON cache_avatar.id = ${Database.userPrefix}_avatar_history.avatar_id WHERE author_id != "${currentUserId}" ORDER BY ${Database.userPrefix}_avatar_history.created_at DESC LIMIT 100`);
}, `SELECT * FROM ${Database.userPrefix}_avatar_history INNER JOIN cache_avatar ON cache_avatar.id = ${Database.userPrefix}_avatar_history.avatar_id WHERE author_id != "${currentUserId}" ORDER BY ${Database.userPrefix}_avatar_history.created_at DESC LIMIT ${limit}`);
return data;
}