- {{
- formatDateFilter(String(userOnlineForTimestamp(userDialog)), 'short')
- }}
+ {{ formatDateFilter(userOnlineForTimestamp(userDialog), 'short') }}
{
try {
@@ -148,7 +153,6 @@ export function reconnectWebSocket() {
/**
* @param {object} args
- * @param {string} args.json.type
*/
function handlePipeline(args) {
const userStore = useUserStore();
diff --git a/src/shared/utils/invite.js b/src/shared/utils/invite.js
index 072c2aa4..f9c6e2e0 100644
--- a/src/shared/utils/invite.js
+++ b/src/shared/utils/invite.js
@@ -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();
diff --git a/src/shared/utils/user.js b/src/shared/utils/user.js
index c0eb2a66..3b612b8d 100644
--- a/src/shared/utils/user.js
+++ b/src/shared/utils/user.js
@@ -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;
}
/**
diff --git a/src/stores/friend.js b/src/stores/friend.js
index c7f3478a..6c37c4c9 100644
--- a/src/stores/friend.js
+++ b/src/stores/friend.js
@@ -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
diff --git a/src/stores/group.js b/src/stores/group.js
index f4e48292..1f25fd21 100644
--- a/src/stores/group.js
+++ b/src/stores/group.js
@@ -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;
});
}
diff --git a/src/stores/settings/general.js b/src/stores/settings/general.js
index fbf6a692..fd946ddd 100644
--- a/src/stores/settings/general.js
+++ b/src/stores/settings/general.js
@@ -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;
diff --git a/src/stores/user.js b/src/stores/user.js
index 6653c2ad..93acd24e 100644
--- a/src/stores/user.js
+++ b/src/stores/user.js
@@ -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;
});
diff --git a/src/views/Favorites/components/FavoritesAvatarLocalHistoryItem.vue b/src/views/Favorites/components/FavoritesAvatarLocalHistoryItem.vue
index 14c7b614..f2c7f63d 100644
--- a/src/views/Favorites/components/FavoritesAvatarLocalHistoryItem.vue
+++ b/src/views/Favorites/components/FavoritesAvatarLocalHistoryItem.vue
@@ -15,7 +15,7 @@
icon="el-icon-check"
circle
style="margin-left: 5px"
- @click.stop="selectAvatarWithConfirmation">
+ @click.stop="selectAvatarWithConfirmation(favorite.id)">
diff --git a/src/views/Settings/Settings.vue b/src/views/Settings/Settings.vue
index 904294f0..2309c801 100644
--- a/src/views/Settings/Settings.vue
+++ b/src/views/Settings/Settings.vue
@@ -125,7 +125,7 @@
clearable
:placeholder="t('view.settings.general.favorites.group_placeholder')"
style="margin-top: 8px"
- @change="updateLocalFavoriteFriends">
+ @change="setLocalFavoriteFriendsGroups">