Misc fixes

This commit is contained in:
Natsumi
2025-07-22 01:53:48 +12:00
parent 4fd898d84d
commit b9b0cebd7f
11 changed files with 53 additions and 49 deletions

View File

@@ -93,6 +93,7 @@ const notificationReq = {
* worldId?: string, * worldId?: string,
* worldName?: string, * worldName?: string,
* messageSlot?: string, * messageSlot?: string,
* rsvp?: boolean,
* }} params * }} params
* @param receiverUserId * @param receiverUserId
* @return { Promise<{json: any, params}> } * @return { Promise<{json: any, params}> }

View File

@@ -410,18 +410,19 @@
<el-dropdown-item icon="el-icon-postcard" command="Request Invite Message">{{ <el-dropdown-item icon="el-icon-postcard" command="Request Invite Message">{{
t('dialog.user.actions.request_invite_with_message') t('dialog.user.actions.request_invite_with_message')
}}</el-dropdown-item> }}</el-dropdown-item>
<template <template v-if="isGameRunning">
v-if=" <el-dropdown-item
lastLocation.location && :disabled="!checkCanInvite(lastLocation.location)"
isGameRunning && icon="el-icon-message"
checkCanInvite(lastLocation.location) command="Invite"
"> >{{ t('dialog.user.actions.invite') }}</el-dropdown-item
<el-dropdown-item icon="el-icon-message" command="Invite">{{ >
t('dialog.user.actions.invite') <el-dropdown-item
}}</el-dropdown-item> :disabled="!checkCanInvite(lastLocation.location)"
<el-dropdown-item icon="el-icon-message" command="Invite Message">{{ icon="el-icon-message"
t('dialog.user.actions.invite_with_message') command="Invite Message"
}}</el-dropdown-item> >{{ t('dialog.user.actions.invite_with_message') }}</el-dropdown-item
>
</template> </template>
</template> </template>
<template v-else-if="userDialog.incomingRequest"> <template v-else-if="userDialog.incomingRequest">
@@ -901,9 +902,7 @@
<div class="x-friend-item" style="cursor: default"> <div class="x-friend-item" style="cursor: default">
<el-tooltip :placement="currentUser.id !== userDialog.id ? 'bottom' : 'top'"> <el-tooltip :placement="currentUser.id !== userDialog.id ? 'bottom' : 'top'">
<template #content> <template #content>
<span>{{ <span>{{ formatDateFilter(userOnlineForTimestamp(userDialog), 'short') }}</span>
formatDateFilter(String(userOnlineForTimestamp(userDialog)), 'short')
}}</span>
</template> </template>
<div class="detail"> <div class="detail">
<span <span

View File

@@ -85,7 +85,12 @@ function connectWebSocket(token) {
type: 'error', type: 'error',
text: 'WebSocket Error' text: 'WebSocket Error'
}).show(); }).show();
socket.onclose(); socket.onclose(
new CloseEvent('close', {
code: 1006, // Abnormal Closure
reason: 'WebSocket Error'
})
);
}; };
socket.onmessage = ({ data }) => { socket.onmessage = ({ data }) => {
try { try {
@@ -148,7 +153,6 @@ export function reconnectWebSocket() {
/** /**
* @param {object} args * @param {object} args
* @param {string} args.json.type
*/ */
function handlePipeline(args) { function handlePipeline(args) {
const userStore = useUserStore(); const userStore = useUserStore();

View File

@@ -12,6 +12,9 @@ import { parseLocation } from './location';
* @returns * @returns
*/ */
function checkCanInvite(location) { function checkCanInvite(location) {
if (!location) {
return false;
}
const userStore = useUserStore(); const userStore = useUserStore();
const locationStore = useLocationStore(); const locationStore = useLocationStore();
const instanceStore = useInstanceStore(); const instanceStore = useInstanceStore();
@@ -42,6 +45,9 @@ function checkCanInvite(location) {
* @returns * @returns
*/ */
function checkCanInviteSelf(location) { function checkCanInviteSelf(location) {
if (!location) {
return false;
}
const userStore = useUserStore(); const userStore = useUserStore();
const instanceStore = useInstanceStore(); const instanceStore = useInstanceStore();
const friendStore = useFriendStore(); const friendStore = useFriendStore();

View File

@@ -8,17 +8,17 @@ import { convertFileUrlToImageUrl } from './common';
/** /**
* *
* @param {object} ctx * @param {object} ctx
* @returns {number} * @returns {string?}
*/ */
function userOnlineForTimestamp(ctx) { function userOnlineForTimestamp(ctx) {
if (ctx.ref.state === 'online' && ctx.ref.$online_for) { if (ctx.ref.state === 'online' && ctx.ref.$online_for) {
return ctx.ref.$online_for; return new Date(ctx.ref.$online_for).toJSON();
} else if (ctx.ref.state === 'active' && ctx.ref.$active_for) { } else if (ctx.ref.state === 'active' && ctx.ref.$active_for) {
return ctx.ref.$active_for; return new Date(ctx.ref.$active_for).toJSON();
} else if (ctx.ref.$offline_for) { } else if (ctx.ref.$offline_for) {
return ctx.ref.$offline_for; return new Date(ctx.ref.$offline_for).toJSON();
} }
return 0; return null;
} }
/** /**

View File

@@ -369,9 +369,6 @@ export const useFriendStore = defineStore('Friend', () => {
function updateLocalFavoriteFriends() { function updateLocalFavoriteFriends() {
const favoriteStore = useFavoriteStore(); const favoriteStore = useFavoriteStore();
const { cachedFavorites } = favoriteStore; const { cachedFavorites } = favoriteStore;
generalSettingsStore.setLocalFavoriteFriendsGroups(
generalSettingsStore.localFavoriteFriendsGroups
);
state.localFavoriteFriends.clear(); state.localFavoriteFriends.clear();
for (const ref of cachedFavorites.values()) { for (const ref of cachedFavorites.values()) {
if ( if (
@@ -1112,13 +1109,7 @@ export const useFriendStore = defineStore('Friend', () => {
} }
const ref = userStore.cachedUsers.get(id); const ref = userStore.cachedUsers.get(id);
if (typeof ref === 'undefined') { if (typeof ref === 'undefined') {
try { // deleted account on friends list
userRequest.getUser({
userId: id
});
} catch (err) {
console.error('Fetch user on add as friend', err);
}
return; return;
} }
friendRequest friendRequest

View File

@@ -11,7 +11,7 @@ import { $app } from '../app';
import configRepository from '../service/config'; import configRepository from '../service/config';
import { watchState } from '../service/watchState'; import { watchState } from '../service/watchState';
import { groupDialogFilterOptions } from '../shared/constants/'; import { groupDialogFilterOptions } from '../shared/constants/';
import { replaceBioSymbols } from '../shared/utils'; import { replaceBioSymbols, convertFileUrlToImageUrl } from '../shared/utils';
import { useGameStore } from './game'; import { useGameStore } from './game';
import { useInstanceStore } from './instance'; import { useInstanceStore } from './instance';
import { useUserStore } from './user'; import { useUserStore } from './user';
@@ -685,9 +685,6 @@ export const useGroupStore = defineStore('Group', () => {
// keep roleIds // keep roleIds
json.myMember.roleIds = ref.myMember.roleIds; json.myMember.roleIds = ref.myMember.roleIds;
} }
if (typeof json.myMember.isRepresenting !== 'undefined') {
json.myMember.isRepresenting = ref.myMember.isRepresenting;
}
Object.assign(ref.myMember, json.myMember); Object.assign(ref.myMember, json.myMember);
} }
Object.assign(ref, json); Object.assign(ref, json);
@@ -722,11 +719,23 @@ export const useGroupStore = defineStore('Group', () => {
} }
function handleGroupRepresented(args) { function handleGroupRepresented(args) {
const D = userStore.userDialog;
const json = args.json; const json = args.json;
D.representedGroup = json;
D.representedGroup.$thumbnailUrl = convertFileUrlToImageUrl(
json.iconUrl
);
if (!json || !json.isRepresenting) {
D.isRepresentedGroupLoading = false;
}
if (!json.groupId) { if (!json.groupId) {
// no group // no group
return; return;
} }
if (args.params.userId !== userStore.currentUser.id) {
// not current user, don't apply someone elses myMember
return;
}
json.$memberId = json.id; json.$memberId = json.id;
json.id = json.groupId; json.id = json.groupId;
applyGroup(json); applyGroup(json);
@@ -1002,7 +1011,6 @@ export const useGroupStore = defineStore('Group', () => {
}) })
.then((args) => { .then((args) => {
handleGroupRepresented(args); handleGroupRepresented(args);
userStore.userDialog.representedGroup = args.json;
return args; return args;
}); });
} }

View File

@@ -6,10 +6,12 @@ import { t } from '../../plugin';
import configRepository from '../../service/config'; import configRepository from '../../service/config';
import { useVrcxStore } from '../vrcx'; import { useVrcxStore } from '../vrcx';
import { useVRCXUpdaterStore } from '../vrcxUpdater'; import { useVRCXUpdaterStore } from '../vrcxUpdater';
import { useFriendStore } from '../friend';
export const useGeneralSettingsStore = defineStore('GeneralSettings', () => { export const useGeneralSettingsStore = defineStore('GeneralSettings', () => {
const vrcxStore = useVrcxStore(); const vrcxStore = useVrcxStore();
const VRCXUpdaterStore = useVRCXUpdaterStore(); const VRCXUpdaterStore = useVRCXUpdaterStore();
const friendStore = useFriendStore();
const state = reactive({ const state = reactive({
isStartAtWindowsStartup: false, isStartAtWindowsStartup: false,
isStartAsMinimizedState: false, isStartAsMinimizedState: false,
@@ -184,6 +186,7 @@ export const useGeneralSettingsStore = defineStore('GeneralSettings', () => {
'VRCX_localFavoriteFriendsGroups', 'VRCX_localFavoriteFriendsGroups',
JSON.stringify(value) JSON.stringify(value)
); );
friendStore.updateLocalFavoriteFriends();
} }
function setUdonExceptionLogging() { function setUdonExceptionLogging() {
state.udonExceptionLogging = !state.udonExceptionLogging; state.udonExceptionLogging = !state.udonExceptionLogging;

View File

@@ -20,7 +20,6 @@ import {
compareByLocationAt, compareByLocationAt,
compareByName, compareByName,
compareByUpdatedAt, compareByUpdatedAt,
convertFileUrlToImageUrl,
extractFileId, extractFileId,
getAllUserMemos, getAllUserMemos,
getGroupName, getGroupName,
@@ -947,14 +946,6 @@ export const useUserStore = defineStore('User', () => {
.getRepresentedGroup({ userId }) .getRepresentedGroup({ userId })
.then((args1) => { .then((args1) => {
groupStore.handleGroupRepresented(args1); groupStore.handleGroupRepresented(args1);
D.representedGroup = args1.json;
D.representedGroup.$thumbnailUrl =
convertFileUrlToImageUrl(
args1.json.iconUrl
);
if (!args1.json || !args1.json.isRepresenting) {
D.isRepresentedGroupLoading = false;
}
}); });
D.loading = false; D.loading = false;
}); });

View File

@@ -15,7 +15,7 @@
icon="el-icon-check" icon="el-icon-check"
circle circle
style="margin-left: 5px" style="margin-left: 5px"
@click.stop="selectAvatarWithConfirmation"></el-button> @click.stop="selectAvatarWithConfirmation(favorite.id)"></el-button>
</el-tooltip> </el-tooltip>
<template v-if="cachedFavoritesByObjectId.has(favorite.id)"> <template v-if="cachedFavoritesByObjectId.has(favorite.id)">
<el-tooltip placement="right" content="Unfavorite" :disabled="hideTooltips"> <el-tooltip placement="right" content="Unfavorite" :disabled="hideTooltips">

View File

@@ -125,7 +125,7 @@
clearable clearable
:placeholder="t('view.settings.general.favorites.group_placeholder')" :placeholder="t('view.settings.general.favorites.group_placeholder')"
style="margin-top: 8px" style="margin-top: 8px"
@change="updateLocalFavoriteFriends"> @change="setLocalFavoriteFriendsGroups">
<el-option-group :label="t('view.settings.general.favorites.group_placeholder')"> <el-option-group :label="t('view.settings.general.favorites.group_placeholder')">
<el-option <el-option
v-for="group in favoriteFriendGroups" v-for="group in favoriteFriendGroups"
@@ -1934,7 +1934,7 @@
timeoutHudOverlay, timeoutHudOverlay,
timeoutHudOverlayFilter timeoutHudOverlayFilter
} = storeToRefs(usePhotonStore()); } = storeToRefs(usePhotonStore());
const { updateLocalFavoriteFriends, saveSidebarSortOrder } = useFriendStore(); const { saveSidebarSortOrder } = useFriendStore();
const { cachedWorlds } = storeToRefs(useWorldStore()); const { cachedWorlds } = storeToRefs(useWorldStore());
const { cachedInstances } = storeToRefs(useInstanceStore()); const { cachedInstances } = storeToRefs(useInstanceStore());
const { showLaunchOptions } = useLaunchStore(); const { showLaunchOptions } = useLaunchStore();
@@ -1942,6 +1942,7 @@
const { enablePrimaryPasswordChange } = useAuthStore(); const { enablePrimaryPasswordChange } = useAuthStore();
const { saveOpenVROption, updateVRLastLocation, updateOpenVR, updateVRConfigVars } = useVrStore(); const { saveOpenVROption, updateVRLastLocation, updateOpenVR, updateVRConfigVars } = useVrStore();
const { clearVRCXCache, showRegistryBackupDialog } = useVrcxStore(); const { clearVRCXCache, showRegistryBackupDialog } = useVrcxStore();
const { setLocalFavoriteFriendsGroups } = useGeneralSettingsStore();
const { const {
isStartAtWindowsStartup, isStartAtWindowsStartup,