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,
* worldName?: string,
* messageSlot?: string,
* rsvp?: boolean,
* }} params
* @param receiverUserId
* @return { Promise<{json: any, params}> }

View File

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

View File

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

View File

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

View File

@@ -8,17 +8,17 @@ import { convertFileUrlToImageUrl } from './common';
/**
*
* @param {object} ctx
* @returns {number}
* @returns {string?}
*/
function userOnlineForTimestamp(ctx) {
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) {
return ctx.ref.$active_for;
return new Date(ctx.ref.$active_for).toJSON();
} 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() {
const favoriteStore = useFavoriteStore();
const { cachedFavorites } = favoriteStore;
generalSettingsStore.setLocalFavoriteFriendsGroups(
generalSettingsStore.localFavoriteFriendsGroups
);
state.localFavoriteFriends.clear();
for (const ref of cachedFavorites.values()) {
if (
@@ -1112,13 +1109,7 @@ export const useFriendStore = defineStore('Friend', () => {
}
const ref = userStore.cachedUsers.get(id);
if (typeof ref === 'undefined') {
try {
userRequest.getUser({
userId: id
});
} catch (err) {
console.error('Fetch user on add as friend', err);
}
// deleted account on friends list
return;
}
friendRequest

View File

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

View File

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

View File

@@ -20,7 +20,6 @@ import {
compareByLocationAt,
compareByName,
compareByUpdatedAt,
convertFileUrlToImageUrl,
extractFileId,
getAllUserMemos,
getGroupName,
@@ -947,14 +946,6 @@ export const useUserStore = defineStore('User', () => {
.getRepresentedGroup({ userId })
.then((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;
});

View File

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

View File

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