mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-30 04:03:48 +02:00
cleanup
This commit is contained in:
@@ -145,15 +145,17 @@ function mountComponent(overrides = {}) {
|
||||
});
|
||||
|
||||
const groupStore = useGroupStore(pinia);
|
||||
groupStore.groupDialog = {
|
||||
id: 'grp_1',
|
||||
visible: true,
|
||||
ref: {
|
||||
galleries: [...MOCK_GALLERIES]
|
||||
},
|
||||
galleries: { ...MOCK_GALLERY_IMAGES },
|
||||
...overrides
|
||||
};
|
||||
groupStore.$patch({
|
||||
groupDialog: {
|
||||
id: 'grp_1',
|
||||
visible: true,
|
||||
ref: {
|
||||
galleries: [...MOCK_GALLERIES]
|
||||
},
|
||||
galleries: { ...MOCK_GALLERY_IMAGES },
|
||||
...overrides
|
||||
}
|
||||
});
|
||||
|
||||
return mount(GroupDialogPhotosTab, {
|
||||
global: {
|
||||
|
||||
@@ -138,21 +138,23 @@ function mountComponent(overrides = {}) {
|
||||
});
|
||||
|
||||
const groupStore = useGroupStore(pinia);
|
||||
groupStore.groupDialog = {
|
||||
id: 'grp_1',
|
||||
visible: true,
|
||||
posts: [...MOCK_POSTS],
|
||||
postsFiltered: [...MOCK_POSTS],
|
||||
postsSearch: '',
|
||||
ref: {
|
||||
roles: [
|
||||
{ id: 'role_1', name: 'Admin' },
|
||||
{ id: 'role_2', name: 'Member' }
|
||||
],
|
||||
permissions: []
|
||||
},
|
||||
...overrides
|
||||
};
|
||||
groupStore.$patch({
|
||||
groupDialog: {
|
||||
id: 'grp_1',
|
||||
visible: true,
|
||||
posts: [...MOCK_POSTS],
|
||||
postsFiltered: [...MOCK_POSTS],
|
||||
postsSearch: '',
|
||||
ref: {
|
||||
roles: [
|
||||
{ id: 'role_1', name: 'Admin' },
|
||||
{ id: 'role_2', name: 'Member' }
|
||||
],
|
||||
permissions: []
|
||||
},
|
||||
...overrides
|
||||
}
|
||||
});
|
||||
|
||||
return mount(GroupDialogPostsTab, {
|
||||
global: {
|
||||
|
||||
@@ -118,20 +118,22 @@ function mountComponent(overrides = {}) {
|
||||
});
|
||||
|
||||
const userStore = useUserStore(pinia);
|
||||
userStore.userDialog = {
|
||||
id: 'usr_me',
|
||||
ref: { id: 'usr_me' },
|
||||
avatars: [...MOCK_AVATARS],
|
||||
avatarSorting: 'name',
|
||||
avatarReleaseStatus: 'all',
|
||||
isAvatarsLoading: false,
|
||||
isWorldsLoading: false,
|
||||
...overrides
|
||||
};
|
||||
userStore.currentUser = {
|
||||
id: 'usr_me',
|
||||
...overrides.currentUser
|
||||
};
|
||||
userStore.$patch({
|
||||
userDialog: {
|
||||
id: 'usr_me',
|
||||
ref: { id: 'usr_me' },
|
||||
avatars: [...MOCK_AVATARS],
|
||||
avatarSorting: 'name',
|
||||
avatarReleaseStatus: 'all',
|
||||
isAvatarsLoading: false,
|
||||
isWorldsLoading: false,
|
||||
...overrides
|
||||
},
|
||||
currentUser: {
|
||||
id: 'usr_me',
|
||||
...overrides.currentUser
|
||||
}
|
||||
});
|
||||
|
||||
return mount(UserDialogAvatarsTab, {
|
||||
global: {
|
||||
|
||||
@@ -109,92 +109,100 @@ function mountComponent(overrides = {}) {
|
||||
});
|
||||
|
||||
const appearanceSettingsStore = useAppearanceSettingsStore(pinia);
|
||||
appearanceSettingsStore.hideUserNotes = false;
|
||||
appearanceSettingsStore.hideUserMemos = false;
|
||||
appearanceSettingsStore.$patch({
|
||||
hideUserNotes: false,
|
||||
hideUserMemos: false
|
||||
});
|
||||
|
||||
const advancedSettingsStore = useAdvancedSettingsStore(pinia);
|
||||
advancedSettingsStore.bioLanguage = 'en';
|
||||
advancedSettingsStore.translationApi = '';
|
||||
advancedSettingsStore.translationApiType = 'google';
|
||||
advancedSettingsStore.translateText = vi.fn().mockResolvedValue('');
|
||||
advancedSettingsStore.$patch({
|
||||
bioLanguage: 'en',
|
||||
translationApi: '',
|
||||
translationApiType: 'google'
|
||||
});
|
||||
const advancedSettings = advancedSettingsStore;
|
||||
advancedSettings.translateText = vi.fn().mockResolvedValue('');
|
||||
|
||||
const userStore = useUserStore(pinia);
|
||||
userStore.userDialog = {
|
||||
id: 'usr_target',
|
||||
friend: {
|
||||
state: 'online',
|
||||
ref: {
|
||||
location: 'wrld_test:123'
|
||||
}
|
||||
},
|
||||
ref: {
|
||||
userStore.$patch({
|
||||
userDialog: {
|
||||
id: 'usr_target',
|
||||
location: 'wrld_test:123',
|
||||
travelingToLocation: '',
|
||||
profilePicOverride: '',
|
||||
currentAvatarImageUrl: '',
|
||||
currentAvatarTags: [],
|
||||
bio: '',
|
||||
bioLinks: [],
|
||||
state: 'online',
|
||||
$online_for: 1000,
|
||||
last_login: '2025-01-01T00:00:00.000Z',
|
||||
last_activity: '2025-01-01T00:00:00.000Z',
|
||||
date_joined: '2020-01-01',
|
||||
friend: {
|
||||
state: 'online',
|
||||
ref: {
|
||||
location: 'wrld_test:123'
|
||||
}
|
||||
},
|
||||
ref: {
|
||||
id: 'usr_target',
|
||||
location: 'wrld_test:123',
|
||||
travelingToLocation: '',
|
||||
profilePicOverride: '',
|
||||
currentAvatarImageUrl: '',
|
||||
currentAvatarTags: [],
|
||||
bio: '',
|
||||
bioLinks: [],
|
||||
state: 'online',
|
||||
$online_for: 1000,
|
||||
last_login: '2025-01-01T00:00:00.000Z',
|
||||
last_activity: '2025-01-01T00:00:00.000Z',
|
||||
date_joined: '2020-01-01',
|
||||
allowAvatarCopying: true,
|
||||
displayName: 'Target'
|
||||
},
|
||||
$location: {
|
||||
tag: 'wrld_test:123',
|
||||
shortName: 'Test',
|
||||
userId: '',
|
||||
user: null
|
||||
},
|
||||
instance: {
|
||||
ref: {},
|
||||
friendCount: 0
|
||||
},
|
||||
users: [
|
||||
{
|
||||
id: 'usr_friend_1',
|
||||
displayName: 'Friend A',
|
||||
$userColour: '#ffffff',
|
||||
location: 'traveling',
|
||||
$travelingToTime: Date.now(),
|
||||
$location_at: Date.now()
|
||||
}
|
||||
],
|
||||
note: '',
|
||||
memo: '',
|
||||
isRepresentedGroupLoading: false,
|
||||
representedGroup: null,
|
||||
lastSeen: '2025-01-01T00:00:00.000Z',
|
||||
joinCount: 0,
|
||||
timeSpent: 0,
|
||||
dateFriendedInfo: [],
|
||||
unFriended: false,
|
||||
dateFriended: '2025-01-01T00:00:00.000Z',
|
||||
$homeLocationName: '',
|
||||
...overrides.userDialog
|
||||
},
|
||||
currentUser: {
|
||||
id: 'usr_me',
|
||||
allowAvatarCopying: true,
|
||||
displayName: 'Target'
|
||||
},
|
||||
$location: {
|
||||
tag: 'wrld_test:123',
|
||||
shortName: 'Test',
|
||||
userId: '',
|
||||
user: null
|
||||
},
|
||||
instance: {
|
||||
ref: {},
|
||||
friendCount: 0
|
||||
},
|
||||
users: [
|
||||
{
|
||||
id: 'usr_friend_1',
|
||||
displayName: 'Friend A',
|
||||
$userColour: '#ffffff',
|
||||
location: 'traveling',
|
||||
$travelingToTime: Date.now(),
|
||||
$location_at: Date.now()
|
||||
}
|
||||
],
|
||||
note: '',
|
||||
memo: '',
|
||||
isRepresentedGroupLoading: false,
|
||||
representedGroup: null,
|
||||
lastSeen: '2025-01-01T00:00:00.000Z',
|
||||
joinCount: 0,
|
||||
timeSpent: 0,
|
||||
dateFriendedInfo: [],
|
||||
unFriended: false,
|
||||
dateFriended: '2025-01-01T00:00:00.000Z',
|
||||
$homeLocationName: '',
|
||||
...overrides.userDialog
|
||||
};
|
||||
|
||||
userStore.currentUser = {
|
||||
id: 'usr_me',
|
||||
allowAvatarCopying: true,
|
||||
isBoopingEnabled: true,
|
||||
hasSharedConnectionsOptOut: false,
|
||||
hasDiscordFriendsOptOut: false,
|
||||
homeLocation: '',
|
||||
...overrides.currentUser
|
||||
};
|
||||
isBoopingEnabled: true,
|
||||
hasSharedConnectionsOptOut: false,
|
||||
hasDiscordFriendsOptOut: false,
|
||||
homeLocation: '',
|
||||
...overrides.currentUser
|
||||
}
|
||||
});
|
||||
|
||||
const locationStore = useLocationStore(pinia);
|
||||
locationStore.lastLocation = {
|
||||
location: 'wrld_test:123'
|
||||
};
|
||||
locationStore.$patch({
|
||||
lastLocation: {
|
||||
location: 'wrld_test:123'
|
||||
}
|
||||
});
|
||||
|
||||
const modalStore = useModalStore(pinia);
|
||||
modalStore.confirm = vi.fn().mockResolvedValue({ ok: false });
|
||||
const modal = useModalStore(pinia);
|
||||
modal.confirm = vi.fn().mockResolvedValue({ ok: false });
|
||||
|
||||
return shallowMount(UserDialogInfoTab, {
|
||||
global: {
|
||||
|
||||
@@ -127,19 +127,22 @@ function mountComponent(overrides = {}) {
|
||||
});
|
||||
|
||||
const userStore = useUserStore(pinia);
|
||||
userStore.userDialog = {
|
||||
id: 'usr_target',
|
||||
ref: { id: 'usr_target' },
|
||||
mutualFriends: [...MOCK_MUTUAL_FRIENDS],
|
||||
mutualFriendSorting: userDialogMutualFriendSortingOptions.alphabetical,
|
||||
isMutualFriendsLoading: false,
|
||||
...overrides
|
||||
};
|
||||
userStore.currentUser = {
|
||||
id: 'usr_me',
|
||||
hasSharedConnectionsOptOut: false,
|
||||
...overrides.currentUser
|
||||
};
|
||||
userStore.$patch({
|
||||
userDialog: {
|
||||
id: 'usr_target',
|
||||
ref: { id: 'usr_target' },
|
||||
mutualFriends: [...MOCK_MUTUAL_FRIENDS],
|
||||
mutualFriendSorting:
|
||||
userDialogMutualFriendSortingOptions.alphabetical,
|
||||
isMutualFriendsLoading: false,
|
||||
...overrides
|
||||
},
|
||||
currentUser: {
|
||||
id: 'usr_me',
|
||||
hasSharedConnectionsOptOut: false,
|
||||
...overrides.currentUser
|
||||
}
|
||||
});
|
||||
|
||||
return mount(UserDialogMutualFriendsTab, {
|
||||
global: {
|
||||
@@ -215,15 +218,17 @@ describe('UserDialogMutualFriendsTab.vue', () => {
|
||||
test('calls showUserDialog when a friend is clicked', async () => {
|
||||
const pinia = createTestingPinia({ stubActions: false });
|
||||
const userStore = useUserStore(pinia);
|
||||
userStore.userDialog = {
|
||||
id: 'usr_target',
|
||||
ref: { id: 'usr_target' },
|
||||
mutualFriends: [...MOCK_MUTUAL_FRIENDS],
|
||||
mutualFriendSorting:
|
||||
userDialogMutualFriendSortingOptions.alphabetical,
|
||||
isMutualFriendsLoading: false
|
||||
};
|
||||
userStore.currentUser = { id: 'usr_me' };
|
||||
userStore.$patch({
|
||||
userDialog: {
|
||||
id: 'usr_target',
|
||||
ref: { id: 'usr_target' },
|
||||
mutualFriends: [...MOCK_MUTUAL_FRIENDS],
|
||||
mutualFriendSorting:
|
||||
userDialogMutualFriendSortingOptions.alphabetical,
|
||||
isMutualFriendsLoading: false
|
||||
},
|
||||
currentUser: { id: 'usr_me' }
|
||||
});
|
||||
const showUserDialogSpy = vi
|
||||
.spyOn(userCoordinatorModule, 'showUserDialog')
|
||||
.mockImplementation(() => {});
|
||||
|
||||
@@ -137,19 +137,21 @@ function mountComponent(overrides = {}) {
|
||||
});
|
||||
|
||||
const userStore = useUserStore(pinia);
|
||||
userStore.userDialog = {
|
||||
id: 'usr_me',
|
||||
ref: { id: 'usr_me' },
|
||||
worlds: [...MOCK_WORLDS],
|
||||
worldSorting: userDialogWorldSortingOptions.name,
|
||||
worldOrder: userDialogWorldOrderOptions.descending,
|
||||
isWorldsLoading: false,
|
||||
...overrides
|
||||
};
|
||||
userStore.currentUser = {
|
||||
id: 'usr_me',
|
||||
...overrides.currentUser
|
||||
};
|
||||
userStore.$patch({
|
||||
userDialog: {
|
||||
id: 'usr_me',
|
||||
ref: { id: 'usr_me' },
|
||||
worlds: [...MOCK_WORLDS],
|
||||
worldSorting: userDialogWorldSortingOptions.name,
|
||||
worldOrder: userDialogWorldOrderOptions.descending,
|
||||
isWorldsLoading: false,
|
||||
...overrides
|
||||
},
|
||||
currentUser: {
|
||||
id: 'usr_me',
|
||||
...overrides.currentUser
|
||||
}
|
||||
});
|
||||
|
||||
return mount(UserDialogWorldsTab, {
|
||||
global: {
|
||||
@@ -245,15 +247,17 @@ describe('UserDialogWorldsTab.vue', () => {
|
||||
.spyOn(worldCoordinatorModule, 'showWorldDialog')
|
||||
.mockImplementation(() => {});
|
||||
|
||||
userStore.userDialog = {
|
||||
id: 'usr_me',
|
||||
ref: { id: 'usr_me' },
|
||||
worlds: [...MOCK_WORLDS],
|
||||
worldSorting: userDialogWorldSortingOptions.name,
|
||||
worldOrder: userDialogWorldOrderOptions.descending,
|
||||
isWorldsLoading: false
|
||||
};
|
||||
userStore.currentUser = { id: 'usr_me' };
|
||||
userStore.$patch({
|
||||
userDialog: {
|
||||
id: 'usr_me',
|
||||
ref: { id: 'usr_me' },
|
||||
worlds: [...MOCK_WORLDS],
|
||||
worldSorting: userDialogWorldSortingOptions.name,
|
||||
worldOrder: userDialogWorldOrderOptions.descending,
|
||||
isWorldsLoading: false
|
||||
},
|
||||
currentUser: { id: 'usr_me' }
|
||||
});
|
||||
|
||||
const wrapper = mount(UserDialogWorldsTab, {
|
||||
global: {
|
||||
|
||||
128
src/coordinators/__tests__/dateCoordinator.test.js
Normal file
128
src/coordinators/__tests__/dateCoordinator.test.js
Normal file
@@ -0,0 +1,128 @@
|
||||
import { beforeEach, describe, expect, test, vi } from 'vitest';
|
||||
|
||||
const mocks = vi.hoisted(() => ({
|
||||
useAppearanceSettingsStore: vi.fn()
|
||||
}));
|
||||
|
||||
vi.mock('../../stores', () => ({
|
||||
useAppearanceSettingsStore: (...args) =>
|
||||
mocks.useAppearanceSettingsStore(...args)
|
||||
}));
|
||||
|
||||
import { formatDateFilter } from '../dateCoordinator';
|
||||
|
||||
describe('dateCoordinator.formatDateFilter', () => {
|
||||
beforeEach(() => {
|
||||
vi.restoreAllMocks();
|
||||
mocks.useAppearanceSettingsStore.mockReturnValue({
|
||||
dtIsoFormat: false,
|
||||
dtHour12: false,
|
||||
currentCulture: 'en-gb'
|
||||
});
|
||||
});
|
||||
|
||||
test('returns "-" for empty and invalid input', () => {
|
||||
expect(formatDateFilter('', 'long')).toBe('-');
|
||||
expect(formatDateFilter(null, 'long')).toBe('-');
|
||||
expect(formatDateFilter(undefined, 'long')).toBe('-');
|
||||
expect(formatDateFilter('invalid-date', 'long')).toBe('-');
|
||||
});
|
||||
|
||||
test('uses ISO long format when dtIsoFormat is enabled', () => {
|
||||
mocks.useAppearanceSettingsStore.mockReturnValue({
|
||||
dtIsoFormat: true,
|
||||
dtHour12: false,
|
||||
currentCulture: 'ja-jp'
|
||||
});
|
||||
|
||||
const result = formatDateFilter('2024-01-02T03:04:05Z', 'long');
|
||||
expect(result).toMatch(/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/);
|
||||
});
|
||||
|
||||
test('keeps culture unchanged when underscore is not at index 4', () => {
|
||||
mocks.useAppearanceSettingsStore.mockReturnValue({
|
||||
dtIsoFormat: false,
|
||||
dtHour12: false,
|
||||
currentCulture: 'en_us'
|
||||
});
|
||||
const localeSpy = vi.spyOn(Date.prototype, 'toLocaleDateString');
|
||||
localeSpy.mockReturnValue('01/02/2024');
|
||||
|
||||
formatDateFilter('2024-01-02T03:04:05Z', 'date');
|
||||
|
||||
expect(localeSpy).toHaveBeenCalledWith(
|
||||
'en_us',
|
||||
expect.objectContaining({
|
||||
year: 'numeric'
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
test('truncates culture when underscore is at index 4', () => {
|
||||
mocks.useAppearanceSettingsStore.mockReturnValue({
|
||||
dtIsoFormat: false,
|
||||
dtHour12: false,
|
||||
currentCulture: 'abcd_ef'
|
||||
});
|
||||
const localeSpy = vi.spyOn(Date.prototype, 'toLocaleDateString');
|
||||
localeSpy.mockReturnValue('01/02/2024');
|
||||
|
||||
formatDateFilter('2024-01-02T03:04:05Z', 'date');
|
||||
|
||||
expect(localeSpy).toHaveBeenCalledWith(
|
||||
'abcd',
|
||||
expect.objectContaining({
|
||||
year: 'numeric'
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
test('falls back to en-gb when currentCulture is empty', () => {
|
||||
mocks.useAppearanceSettingsStore.mockReturnValue({
|
||||
dtIsoFormat: false,
|
||||
dtHour12: false,
|
||||
currentCulture: ''
|
||||
});
|
||||
const localeSpy = vi.spyOn(Date.prototype, 'toLocaleDateString');
|
||||
localeSpy.mockReturnValue('02/01/2024');
|
||||
|
||||
formatDateFilter('2024-01-02T03:04:05Z', 'date');
|
||||
|
||||
expect(localeSpy).toHaveBeenCalledWith(
|
||||
'en-gb',
|
||||
expect.objectContaining({
|
||||
year: 'numeric'
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
test('uses hourCycle h12 and lowercases AM/PM in short format', () => {
|
||||
mocks.useAppearanceSettingsStore.mockReturnValue({
|
||||
dtIsoFormat: false,
|
||||
dtHour12: true,
|
||||
currentCulture: 'en-us'
|
||||
});
|
||||
const localeSpy = vi.spyOn(Date.prototype, 'toLocaleDateString');
|
||||
localeSpy.mockReturnValue('01/02, 10:30 PM');
|
||||
|
||||
const result = formatDateFilter('2024-01-02T22:30:00Z', 'short');
|
||||
|
||||
expect(localeSpy).toHaveBeenCalledWith(
|
||||
'en-us',
|
||||
expect.objectContaining({
|
||||
hourCycle: 'h12'
|
||||
})
|
||||
);
|
||||
expect(result).toContain('pm');
|
||||
expect(result).not.toContain('PM');
|
||||
});
|
||||
|
||||
test('returns "-" and warns when format is unknown', () => {
|
||||
const warnSpy = vi.spyOn(console, 'warn').mockImplementation(() => {});
|
||||
|
||||
const result = formatDateFilter('2024-01-02T03:04:05Z', 'unknown');
|
||||
|
||||
expect(result).toBe('-');
|
||||
expect(warnSpy).toHaveBeenCalledWith('Unknown date format: unknown');
|
||||
});
|
||||
});
|
||||
@@ -54,7 +54,6 @@ export async function runLogoutFlow() {
|
||||
*/
|
||||
export function runLoginSuccessFlow(json) {
|
||||
const updateLoopStore = useUpdateLoopStore();
|
||||
const userStore = useUserStore();
|
||||
|
||||
updateLoopStore.setNextCurrentUserRefresh(420); // 7mins
|
||||
applyCurrentUser(json);
|
||||
|
||||
@@ -185,7 +185,7 @@ export async function getAvatarHistory() {
|
||||
}
|
||||
applyAvatar(avatar);
|
||||
}
|
||||
avatarStore.avatarHistory = historyArray;
|
||||
avatarStore.setAvatarHistory(historyArray);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -530,8 +530,8 @@ export async function checkAvatarCacheRemote(fileId, ownerUserId) {
|
||||
if (advancedSettingsStore.avatarRemoteDatabase) {
|
||||
try {
|
||||
toast.dismiss(avatarStore.loadingToastId);
|
||||
avatarStore.loadingToastId = toast.loading(
|
||||
t('message.avatar_lookup.loading')
|
||||
avatarStore.setLoadingToastId(
|
||||
toast.loading(t('message.avatar_lookup.loading'))
|
||||
);
|
||||
const avatarId = await lookupAvatarByImageFileId(
|
||||
ownerUserId,
|
||||
|
||||
@@ -113,8 +113,8 @@ export function handleFavoriteAtDelete(ref) {
|
||||
favoriteStore.cachedFavoritesByObjectId.delete(ref.favoriteId);
|
||||
favoriteStore.state.favoriteObjects.delete(ref.favoriteId);
|
||||
friendStore.localFavoriteFriends.delete(ref.favoriteId);
|
||||
favoriteStore.favoritesSortOrder = favoriteStore.favoritesSortOrder.filter(
|
||||
(id) => id !== ref.favoriteId
|
||||
favoriteStore.setFavoritesSortOrder(
|
||||
favoriteStore.favoritesSortOrder.filter((id) => id !== ref.favoriteId)
|
||||
);
|
||||
|
||||
runUpdateFriendFlow(ref.favoriteId);
|
||||
@@ -389,14 +389,14 @@ export function refreshFavorites() {
|
||||
if (favoriteStore.isFavoriteLoading) {
|
||||
return;
|
||||
}
|
||||
favoriteStore.isFavoriteLoading = true;
|
||||
favoriteStore.setIsFavoriteLoading(true);
|
||||
queryRequest
|
||||
.fetch('favoriteLimits')
|
||||
.then((args) => {
|
||||
favoriteStore.favoriteLimits = {
|
||||
favoriteStore.setFavoriteLimits({
|
||||
...favoriteStore.favoriteLimits,
|
||||
...args.json
|
||||
};
|
||||
});
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err);
|
||||
@@ -430,12 +430,12 @@ export function refreshFavorites() {
|
||||
}
|
||||
}
|
||||
}
|
||||
favoriteStore.favoritesSortOrder = newFavoriteSortOrder;
|
||||
favoriteStore.setFavoritesSortOrder(newFavoriteSortOrder);
|
||||
}
|
||||
refreshFavoriteItems();
|
||||
favoriteStore.refreshFavoriteGroups();
|
||||
friendStore.updateLocalFavoriteFriends();
|
||||
favoriteStore.isFavoriteLoading = false;
|
||||
favoriteStore.setIsFavoriteLoading(false);
|
||||
watchState.isFavoritesLoaded = true;
|
||||
favoriteStore.countFavoriteGroups();
|
||||
}
|
||||
@@ -445,7 +445,7 @@ export function refreshFavorites() {
|
||||
/**
|
||||
*
|
||||
* @param {string} tag
|
||||
* @returns {void}
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
export async function refreshFavoriteAvatars(tag) {
|
||||
const params = {
|
||||
|
||||
@@ -5,7 +5,6 @@ import { friendRequest, userRequest } from '../api';
|
||||
import { getNameColour } from '../shared/utils';
|
||||
import { handleFavoriteDelete } from './favoriteCoordinator';
|
||||
import { useAppearanceSettingsStore } from '../stores/settings/appearance';
|
||||
import { useFavoriteStore } from '../stores/favorite';
|
||||
import { useFriendStore } from '../stores/friend';
|
||||
import { useModalStore } from '../stores/modal';
|
||||
import { useNotificationStore } from '../stores/notification';
|
||||
@@ -342,7 +341,6 @@ export function runDeleteFriendshipFlow(
|
||||
const userStore = useUserStore();
|
||||
const notificationStore = useNotificationStore();
|
||||
const sharedFeedStore = useSharedFeedStore();
|
||||
const favoriteStore = useFavoriteStore();
|
||||
const uiStore = useUiStore();
|
||||
const appearanceSettingsStore = useAppearanceSettingsStore();
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@ import configRepository from '../services/config';
|
||||
*/
|
||||
export async function runRefreshFriendsListFlow() {
|
||||
const updateLoopStore = useUpdateLoopStore();
|
||||
const userStore = useUserStore();
|
||||
const friendStore = useFriendStore();
|
||||
|
||||
// If we just got user less then 2 min before code call, don't call it again
|
||||
@@ -38,7 +37,7 @@ export async function runInitFriendsListFlow(t) {
|
||||
const authStore = useAuthStore();
|
||||
|
||||
const userId = userStore.currentUser.id;
|
||||
friendStore.isRefreshFriendsLoading = true;
|
||||
friendStore.setIsRefreshFriendsLoading(true);
|
||||
watchState.isFriendsLoaded = false;
|
||||
friendStore.resetFriendLog();
|
||||
|
||||
|
||||
@@ -33,10 +33,8 @@ export async function runGameRunningChangedFlow(isGameRunning) {
|
||||
const userStore = useUserStore();
|
||||
const instanceStore = useInstanceStore();
|
||||
const updateLoopStore = useUpdateLoopStore();
|
||||
const locationStore = useLocationStore();
|
||||
const gameLogStore = useGameLogStore();
|
||||
const vrStore = useVrStore();
|
||||
const avatarStore = useAvatarStore();
|
||||
const gameStore = useGameStore();
|
||||
|
||||
if (isGameRunning) {
|
||||
|
||||
@@ -304,7 +304,7 @@ export function addGameLogEntry(gameLog, location) {
|
||||
if (gameLogStore.lastVideoUrl === gameLog.videoUrl) {
|
||||
break;
|
||||
}
|
||||
gameLogStore.lastVideoUrl = gameLog.videoUrl;
|
||||
gameLogStore.setLastVideoUrl(gameLog.videoUrl);
|
||||
gameLogStore.addGameLogVideo(gameLog, location, userId);
|
||||
break;
|
||||
case 'video-sync':
|
||||
@@ -321,7 +321,7 @@ export function addGameLogEntry(gameLog, location) {
|
||||
) {
|
||||
break;
|
||||
}
|
||||
gameLogStore.lastResourceloadUrl = gameLog.resourceUrl;
|
||||
gameLogStore.setLastResourceloadUrl(gameLog.resourceUrl);
|
||||
entry = createResourceLoadEntry(
|
||||
gameLog.type,
|
||||
gameLog.dt,
|
||||
|
||||
@@ -57,7 +57,6 @@ function applyGroupLanguage(ref) {
|
||||
*/
|
||||
export function applyGroup(json) {
|
||||
const groupStore = useGroupStore();
|
||||
const userStore = useUserStore();
|
||||
let ref = groupStore.cachedGroups.get(json.id);
|
||||
sanitizeEntityJson(json, ['rules', 'name', 'description']);
|
||||
if (typeof ref === 'undefined') {
|
||||
@@ -629,7 +628,7 @@ export async function loadCurrentUserGroups(userId, groups) {
|
||||
await Promise.allSettled(promises);
|
||||
}
|
||||
|
||||
groupStore.currentUserGroupsInit = true;
|
||||
groupStore.setCurrentUserGroupsInit(true);
|
||||
getCurrentUserGroups();
|
||||
}
|
||||
|
||||
@@ -691,7 +690,7 @@ export async function updateInGameGroupOrder() {
|
||||
const groupStore = useGroupStore();
|
||||
const gameStore = useGameStore();
|
||||
const userStore = useUserStore();
|
||||
groupStore.inGameGroupOrder = [];
|
||||
groupStore.setInGameGroupOrder([]);
|
||||
try {
|
||||
const json = await gameStore.getVRChatRegistryKey(
|
||||
`VRC_GROUP_ORDER_${userStore.currentUser.id}`
|
||||
@@ -699,7 +698,7 @@ export async function updateInGameGroupOrder() {
|
||||
if (!json) {
|
||||
return;
|
||||
}
|
||||
groupStore.inGameGroupOrder = JSON.parse(json);
|
||||
groupStore.setInGameGroupOrder(JSON.parse(json));
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
@@ -925,7 +924,7 @@ export function handleGroupMember(args) {
|
||||
export async function handleGroupUserInstances(args) {
|
||||
const groupStore = useGroupStore();
|
||||
const instanceStore = useInstanceStore();
|
||||
groupStore.groupInstances = [];
|
||||
groupStore.setGroupInstances([]);
|
||||
for (const json of args.json.instances) {
|
||||
if (args.json.fetchedAt) {
|
||||
// tack on fetchedAt
|
||||
|
||||
@@ -669,7 +669,7 @@ export function handleConfig(args) {
|
||||
if (!languages) {
|
||||
return;
|
||||
}
|
||||
userStore.subsetOfLanguages = languages;
|
||||
userStore.setSubsetOfLanguages(languages);
|
||||
const data = [];
|
||||
for (const key in languages) {
|
||||
const value = languages[key];
|
||||
@@ -678,7 +678,7 @@ export function handleConfig(args) {
|
||||
value
|
||||
});
|
||||
}
|
||||
userStore.languageDialog.languages = data;
|
||||
userStore.setLanguageDialogLanguages(data);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { getGroupName, getWorldName, parseLocation } from '../shared/utils';
|
||||
import { AppDebug } from '../services/appConfig';
|
||||
import { database } from '../services/database';
|
||||
import { useAvatarStore } from '../stores/avatar';
|
||||
import { getAvatarName } from './avatarCoordinator';
|
||||
import { useFeedStore } from '../stores/feed';
|
||||
import { useFriendStore } from '../stores/friend';
|
||||
@@ -35,7 +34,6 @@ export async function runHandleUserUpdateFlow(
|
||||
const feedStore = useFeedStore();
|
||||
const notificationStore = useNotificationStore();
|
||||
const sharedFeedStore = useSharedFeedStore();
|
||||
const avatarStore = useAvatarStore();
|
||||
const generalSettingsStore = useGeneralSettingsStore();
|
||||
|
||||
const { state, userDialog, applyUserDialogLocation, checkNote } = userStore;
|
||||
|
||||
@@ -4,11 +4,8 @@ import {
|
||||
updateUserCurrentStatus
|
||||
} from './friendRelationshipCoordinator';
|
||||
import { useAuthStore } from '../stores/auth';
|
||||
import { useAvatarStore } from '../stores/avatar';
|
||||
import { addAvatarToHistory, addAvatarWearTime } from './avatarCoordinator';
|
||||
import { useFriendStore } from '../stores/friend';
|
||||
import { useGameStore } from '../stores/game';
|
||||
import { useGroupStore } from '../stores/group';
|
||||
import { applyPresenceGroups } from './groupCoordinator';
|
||||
import { useInstanceStore } from '../stores/instance';
|
||||
import { useUserStore } from '../stores/user';
|
||||
@@ -26,7 +23,6 @@ export function runAvatarSwapFlow(
|
||||
{ json, ref, isLoggedIn },
|
||||
{ now = Date.now } = {}
|
||||
) {
|
||||
const avatarStore = useAvatarStore();
|
||||
const gameStore = useGameStore();
|
||||
|
||||
if (!isLoggedIn) {
|
||||
@@ -56,7 +52,7 @@ export function runFirstLoginFlow(ref, { now = Date.now } = {}) {
|
||||
ref.$previousAvatarSwapTime = now();
|
||||
}
|
||||
userStore.cachedUsers.clear(); // clear before running applyUser
|
||||
userStore.currentUser = ref;
|
||||
userStore.setCurrentUser(ref);
|
||||
authStore.loginComplete();
|
||||
}
|
||||
|
||||
@@ -65,9 +61,7 @@ export function runFirstLoginFlow(ref, { now = Date.now } = {}) {
|
||||
* @param {object} ref Current user state reference.
|
||||
*/
|
||||
export function runPostApplySyncFlow(ref) {
|
||||
const groupStore = useGroupStore();
|
||||
const instanceStore = useInstanceStore();
|
||||
const friendStore = useFriendStore();
|
||||
|
||||
applyPresenceGroups(ref);
|
||||
instanceStore.applyQueuedInstance(ref.queuedInstance);
|
||||
|
||||
@@ -3,7 +3,6 @@ import { toast } from 'vue-sonner';
|
||||
import { i18n } from '../plugins/i18n';
|
||||
|
||||
import {
|
||||
checkVRChatCache,
|
||||
createDefaultWorldRef,
|
||||
evictMapCache,
|
||||
getAvailablePlatforms,
|
||||
|
||||
@@ -2055,7 +2055,7 @@
|
||||
"action": "Action",
|
||||
"auto_backup": "Auto backup every 3 days (deletes after 2 weeks)",
|
||||
"ask_to_restore": "Ask to restore when no VRC registry settings are present",
|
||||
"restore_prompt": "VRCX has noticed auto backup of VRC registry settings is enabled but this computer doesn't have any, if you'd like to restore from backup you can do so from here."
|
||||
"restore_prompt": "VRCX has noticed auto backup of VRChat registry settings is enabled but this computer doesn't have any, if you'd like to restore from backup you can do so from here."
|
||||
},
|
||||
"avatar_database_provider": {
|
||||
"header": "Avatar Database Provider",
|
||||
|
||||
@@ -1,100 +0,0 @@
|
||||
import { beforeEach, describe, expect, test, vi } from 'vitest';
|
||||
|
||||
// Mock the store
|
||||
vi.mock('../../../../stores', () => ({
|
||||
useAppearanceSettingsStore: vi.fn()
|
||||
}));
|
||||
|
||||
// Mock transitive deps
|
||||
vi.mock('../../../../views/Feed/Feed.vue', () => ({
|
||||
default: { template: '<div />' }
|
||||
}));
|
||||
vi.mock('../../../../views/Feed/columns.jsx', () => ({ columns: [] }));
|
||||
vi.mock('../../../../plugins/router', () => ({
|
||||
default: { push: vi.fn(), currentRoute: { value: {} } }
|
||||
}));
|
||||
|
||||
import { useAppearanceSettingsStore } from '../../../../stores';
|
||||
import { formatDateFilter } from '../../../../coordinators/dateCoordinator';
|
||||
|
||||
describe('formatDateFilter', () => {
|
||||
beforeEach(() => {
|
||||
useAppearanceSettingsStore.mockReturnValue({
|
||||
dtIsoFormat: false,
|
||||
dtHour12: false,
|
||||
currentCulture: 'en-gb'
|
||||
});
|
||||
});
|
||||
|
||||
test('returns dash for empty dateStr', () => {
|
||||
expect(formatDateFilter('', 'long')).toBe('-');
|
||||
expect(formatDateFilter(null, 'long')).toBe('-');
|
||||
expect(formatDateFilter(undefined, 'long')).toBe('-');
|
||||
});
|
||||
|
||||
test('returns dash for invalid dateStr', () => {
|
||||
expect(formatDateFilter('not-a-date', 'long')).toBe('-');
|
||||
});
|
||||
|
||||
test('formats long ISO format', () => {
|
||||
useAppearanceSettingsStore.mockReturnValue({
|
||||
dtIsoFormat: true,
|
||||
dtHour12: false,
|
||||
currentCulture: 'en-gb'
|
||||
});
|
||||
const result = formatDateFilter('2023-06-15T14:30:45Z', 'long');
|
||||
// ISO format: YYYY-MM-DD HH:MM:SS (in local timezone)
|
||||
expect(result).toMatch(/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/);
|
||||
});
|
||||
|
||||
test('formats long locale format', () => {
|
||||
const result = formatDateFilter('2023-06-15T14:30:45Z', 'long');
|
||||
// Result is locale-dependent; just verify it produces something
|
||||
expect(result).not.toBe('-');
|
||||
expect(result.length).toBeGreaterThan(5);
|
||||
});
|
||||
|
||||
test('formats short locale format', () => {
|
||||
const result = formatDateFilter('2023-06-15T14:30:45Z', 'short');
|
||||
expect(result).not.toBe('-');
|
||||
});
|
||||
|
||||
test('formats time only', () => {
|
||||
const result = formatDateFilter('2023-06-15T14:30:45Z', 'time');
|
||||
expect(result).not.toBe('-');
|
||||
});
|
||||
|
||||
test('formats date only', () => {
|
||||
const result = formatDateFilter('2023-06-15T14:30:45Z', 'date');
|
||||
expect(result).not.toBe('-');
|
||||
});
|
||||
|
||||
test('handles culture with no underscore at position 4', () => {
|
||||
useAppearanceSettingsStore.mockReturnValue({
|
||||
dtIsoFormat: false,
|
||||
dtHour12: true,
|
||||
currentCulture: 'en-us'
|
||||
});
|
||||
const result = formatDateFilter('2023-06-15T14:30:45Z', 'long');
|
||||
expect(result).not.toBe('-');
|
||||
});
|
||||
|
||||
test('returns dash for unknown format', () => {
|
||||
const warnSpy = vi.spyOn(console, 'warn').mockImplementation(() => {});
|
||||
const result = formatDateFilter('2023-06-15T14:30:45Z', 'unknown');
|
||||
expect(result).toBe('-');
|
||||
expect(warnSpy).toHaveBeenCalled();
|
||||
warnSpy.mockRestore();
|
||||
});
|
||||
|
||||
test('uses hour12 setting', () => {
|
||||
useAppearanceSettingsStore.mockReturnValue({
|
||||
dtIsoFormat: false,
|
||||
dtHour12: true,
|
||||
currentCulture: 'en-us'
|
||||
});
|
||||
const result = formatDateFilter('2023-06-15T14:30:45Z', 'short');
|
||||
// hour12 should produce am/pm in the output
|
||||
expect(result).not.toBe('-');
|
||||
});
|
||||
});
|
||||
@@ -187,6 +187,20 @@ export const useAvatarStore = defineStore('Avatar', () => {
|
||||
database.clearAvatarHistory();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Array} value
|
||||
*/
|
||||
function setAvatarHistory(value) {
|
||||
avatarHistory.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {*} value
|
||||
*/
|
||||
function setLoadingToastId(value) {
|
||||
loadingToastId.value = value;
|
||||
}
|
||||
|
||||
return {
|
||||
avatarDialog,
|
||||
avatarHistory,
|
||||
@@ -200,6 +214,8 @@ export const useAvatarStore = defineStore('Avatar', () => {
|
||||
getAvatarGallery,
|
||||
updateVRChatAvatarCache,
|
||||
clearAvatarHistory,
|
||||
setAvatarHistory,
|
||||
setLoadingToastId,
|
||||
setAvatarDialogVisible,
|
||||
setAvatarDialogIsFavorite,
|
||||
setAvatarDialogLoading
|
||||
|
||||
@@ -6,7 +6,6 @@ import { useI18n } from 'vue-i18n';
|
||||
import {
|
||||
compareByName,
|
||||
createDefaultFavoriteGroupRef,
|
||||
removeFromArray,
|
||||
replaceReactiveObject
|
||||
} from '../shared/utils';
|
||||
import { favoriteRequest } from '../api';
|
||||
@@ -16,8 +15,6 @@ import { useAppearanceSettingsStore } from './settings/appearance';
|
||||
import { watchState } from '../services/watchState';
|
||||
import { onLoginStateChanged } from '../coordinators/favoriteCoordinator';
|
||||
|
||||
import configRepository from '../services/config';
|
||||
|
||||
export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
const appearanceSettingsStore = useAppearanceSettingsStore();
|
||||
|
||||
@@ -736,6 +733,27 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
return indexA - indexB;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {boolean} value
|
||||
*/
|
||||
function setIsFavoriteLoading(value) {
|
||||
isFavoriteLoading.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {object} value
|
||||
*/
|
||||
function setFavoriteLimits(value) {
|
||||
favoriteLimits.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Array} value
|
||||
*/
|
||||
function setFavoritesSortOrder(value) {
|
||||
favoritesSortOrder.value = value;
|
||||
}
|
||||
|
||||
return {
|
||||
state,
|
||||
|
||||
@@ -799,6 +817,9 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
hasLocalFriendFavorite,
|
||||
isInAnyLocalFriendGroup,
|
||||
newLocalFriendFavoriteGroup,
|
||||
countFavoriteGroups
|
||||
countFavoriteGroups,
|
||||
setIsFavoriteLoading,
|
||||
setFavoriteLimits,
|
||||
setFavoritesSortOrder
|
||||
};
|
||||
});
|
||||
|
||||
@@ -12,10 +12,7 @@ import {
|
||||
} from '../shared/utils';
|
||||
import { getUserMemo } from '../coordinators/memoCoordinator';
|
||||
import { friendRequest, userRequest } from '../api';
|
||||
import {
|
||||
runInitFriendsListFlow,
|
||||
runRefreshFriendsListFlow
|
||||
} from '../coordinators/friendSyncCoordinator';
|
||||
import { runInitFriendsListFlow } from '../coordinators/friendSyncCoordinator';
|
||||
import {
|
||||
runPendingOfflineTickFlow,
|
||||
runUpdateFriendFlow
|
||||
@@ -45,7 +42,6 @@ export const useFriendStore = defineStore('Friend', () => {
|
||||
const userStore = useUserStore();
|
||||
const groupStore = useGroupStore();
|
||||
const locationStore = useLocationStore();
|
||||
const favoriteStore = useFavoriteStore();
|
||||
|
||||
const router = useRouter();
|
||||
const t = i18n.global.t;
|
||||
@@ -1134,6 +1130,13 @@ export const useFriendStore = defineStore('Friend', () => {
|
||||
friendLog.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {boolean} value
|
||||
*/
|
||||
function setIsRefreshFriendsLoading(value) {
|
||||
isRefreshFriendsLoading.value = value;
|
||||
}
|
||||
|
||||
return {
|
||||
state,
|
||||
|
||||
@@ -1169,6 +1172,7 @@ export const useFriendStore = defineStore('Friend', () => {
|
||||
getFriendLog,
|
||||
tryApplyFriendOrder,
|
||||
resetFriendLog,
|
||||
initFriendLogHistoryTable
|
||||
initFriendLogHistoryTable,
|
||||
setIsRefreshFriendsLoading
|
||||
};
|
||||
});
|
||||
|
||||
@@ -31,8 +31,6 @@ export const useGameStore = defineStore('Game', () => {
|
||||
|
||||
init();
|
||||
|
||||
// --- Atomic setters ---
|
||||
|
||||
/**
|
||||
* @param {boolean} value Game running flag.
|
||||
*/
|
||||
@@ -68,8 +66,6 @@ export const useGameStore = defineStore('Game', () => {
|
||||
state.lastCrashedTime = value;
|
||||
}
|
||||
|
||||
// --- Self-contained operations (no cross-store deps) ---
|
||||
|
||||
/**
|
||||
* Fetches VRChat cache size from AssetBundleManager.
|
||||
*/
|
||||
|
||||
@@ -2,8 +2,6 @@ import { reactive, ref, shallowRef, watch } from 'vue';
|
||||
import { defineStore } from 'pinia';
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
import {
|
||||
compareGameLogRows,
|
||||
findUserByDisplayName,
|
||||
@@ -16,11 +14,7 @@ import { database } from '../../services/database';
|
||||
import { tryLoadPlayerList } from '../../coordinators/gameLogCoordinator';
|
||||
import { useAdvancedSettingsStore } from '../settings/advanced';
|
||||
import { useFriendStore } from '../friend';
|
||||
import { useGameStore } from '../game';
|
||||
import { useInstanceStore } from '../instance';
|
||||
import { useLocationStore } from '../location';
|
||||
import { useNotificationStore } from '../notification';
|
||||
import { useSharedFeedStore } from '../sharedFeed';
|
||||
import { useUiStore } from '../ui';
|
||||
import { useUserStore } from '../user';
|
||||
import { useVrStore } from '../vr';
|
||||
@@ -34,15 +28,11 @@ import * as workerTimers from 'worker-timers';
|
||||
export const useGameLogStore = defineStore('GameLog', () => {
|
||||
const notificationStore = useNotificationStore();
|
||||
const vrStore = useVrStore();
|
||||
const locationStore = useLocationStore();
|
||||
const friendStore = useFriendStore();
|
||||
const instanceStore = useInstanceStore();
|
||||
const userStore = useUserStore();
|
||||
const uiStore = useUiStore();
|
||||
const vrcxStore = useVrcxStore();
|
||||
const advancedSettingsStore = useAdvancedSettingsStore();
|
||||
const gameStore = useGameStore();
|
||||
const sharedFeedStore = useSharedFeedStore();
|
||||
|
||||
const router = useRouter();
|
||||
|
||||
@@ -449,6 +439,20 @@ export const useGameLogStore = defineStore('GameLog', () => {
|
||||
gameLogTable.value.loading = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} value
|
||||
*/
|
||||
function setLastVideoUrl(value) {
|
||||
lastVideoUrl.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} value
|
||||
*/
|
||||
function setLastResourceloadUrl(value) {
|
||||
lastResourceloadUrl.value = value;
|
||||
}
|
||||
|
||||
return {
|
||||
state,
|
||||
|
||||
@@ -472,6 +476,8 @@ export const useGameLogStore = defineStore('GameLog', () => {
|
||||
addGameLogVRDancing,
|
||||
addGameLogZuwaZuwaDance,
|
||||
addGameLogLSMedia,
|
||||
addGameLogPopcornPalace
|
||||
addGameLogPopcornPalace,
|
||||
setLastVideoUrl,
|
||||
setLastResourceloadUrl
|
||||
};
|
||||
});
|
||||
|
||||
@@ -4,7 +4,6 @@ import { useI18n } from 'vue-i18n';
|
||||
|
||||
import { hasGroupPermission, replaceBioSymbols } from '../shared/utils';
|
||||
import { groupRequest, queryRequest } from '../api';
|
||||
import { groupDialogFilterOptions } from '../shared/constants/';
|
||||
import { watchState } from '../services/watchState';
|
||||
|
||||
export const useGroupStore = defineStore('Group', () => {
|
||||
@@ -288,6 +287,27 @@ export const useGroupStore = defineStore('Group', () => {
|
||||
D.visible = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {boolean} value
|
||||
*/
|
||||
function setCurrentUserGroupsInit(value) {
|
||||
currentUserGroupsInit.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Array} value
|
||||
*/
|
||||
function setInGameGroupOrder(value) {
|
||||
inGameGroupOrder.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Array} value
|
||||
*/
|
||||
function setGroupInstances(value) {
|
||||
groupInstances.value = value;
|
||||
}
|
||||
|
||||
return {
|
||||
groupDialog,
|
||||
currentUserGroups,
|
||||
@@ -306,6 +326,9 @@ export const useGroupStore = defineStore('Group', () => {
|
||||
clearGroupInstances,
|
||||
setGroupDialogVisible,
|
||||
showModerateGroupDialog,
|
||||
showGroupMemberModerationDialog
|
||||
showGroupMemberModerationDialog,
|
||||
setCurrentUserGroupsInit,
|
||||
setInGameGroupOrder,
|
||||
setGroupInstances
|
||||
};
|
||||
});
|
||||
|
||||
@@ -75,7 +75,6 @@ export const useNotificationStore = defineStore('Notification', () => {
|
||||
const sharedFeedStore = useSharedFeedStore();
|
||||
const instanceStore = useInstanceStore();
|
||||
const modalStore = useModalStore();
|
||||
const groupStore = useGroupStore();
|
||||
|
||||
const notificationInitStatus = ref(false);
|
||||
const notificationTable = ref({
|
||||
|
||||
@@ -9,9 +9,7 @@ import { instanceRequest, userRequest } from '../api';
|
||||
import { groupRequest } from '../api/';
|
||||
import removeConfusables, { removeWhitespace } from '../services/confusables';
|
||||
import { useAppearanceSettingsStore } from './settings/appearance';
|
||||
import { useAvatarStore } from './avatar';
|
||||
import { useFriendStore } from './friend';
|
||||
import { useGroupStore } from './group';
|
||||
import { showGroupDialog } from '../coordinators/groupCoordinator';
|
||||
import { showWorldDialog } from '../coordinators/worldCoordinator';
|
||||
import { showAvatarDialog } from '../coordinators/avatarCoordinator';
|
||||
@@ -22,7 +20,6 @@ import {
|
||||
} from '../coordinators/userCoordinator';
|
||||
import { useModalStore } from './modal';
|
||||
import { useUserStore } from './user';
|
||||
import { useWorldStore } from './world';
|
||||
import { watchState } from '../services/watchState';
|
||||
|
||||
export const useSearchStore = defineStore('Search', () => {
|
||||
@@ -30,9 +27,6 @@ export const useSearchStore = defineStore('Search', () => {
|
||||
const router = useRouter();
|
||||
const appearanceSettingsStore = useAppearanceSettingsStore();
|
||||
const friendStore = useFriendStore();
|
||||
const worldStore = useWorldStore();
|
||||
const avatarStore = useAvatarStore();
|
||||
const groupStore = useGroupStore();
|
||||
const modalStore = useModalStore();
|
||||
const { t } = useI18n();
|
||||
|
||||
|
||||
@@ -22,10 +22,6 @@ import { useWorldStore } from './world';
|
||||
|
||||
export const useUiStore = defineStore('Ui', () => {
|
||||
const notificationStore = useNotificationStore();
|
||||
const userStore = useUserStore();
|
||||
const worldStore = useWorldStore();
|
||||
const avatarStore = useAvatarStore();
|
||||
const groupStore = useGroupStore();
|
||||
const instanceStore = useInstanceStore();
|
||||
const router = useRouter();
|
||||
const keys = useMagicKeys();
|
||||
|
||||
@@ -11,14 +11,11 @@ import { clearVRCXCache } from '../coordinators/vrcxCoordinator';
|
||||
import { useAuthStore } from './auth';
|
||||
import { useDiscordPresenceSettingsStore } from './settings/discordPresence';
|
||||
import { useFriendStore } from './friend';
|
||||
import { useGameStore } from './game';
|
||||
import { useGroupStore } from './group';
|
||||
import { handleGroupUserInstances } from '../coordinators/groupCoordinator';
|
||||
import {
|
||||
getCurrentUser,
|
||||
updateAutoStateChange
|
||||
} from '../coordinators/userCoordinator';
|
||||
import { useModerationStore } from './moderation';
|
||||
import { useUserStore } from './user';
|
||||
import { useVRCXUpdaterStore } from './vrcxUpdater';
|
||||
import { useVrStore } from './vr';
|
||||
@@ -31,12 +28,9 @@ export const useUpdateLoopStore = defineStore('UpdateLoop', () => {
|
||||
const authStore = useAuthStore();
|
||||
const userStore = useUserStore();
|
||||
const friendStore = useFriendStore();
|
||||
const gameStore = useGameStore();
|
||||
const moderationStore = useModerationStore();
|
||||
const vrcxStore = useVrcxStore();
|
||||
const discordPresenceSettingsStore = useDiscordPresenceSettingsStore();
|
||||
const vrcxUpdaterStore = useVRCXUpdaterStore();
|
||||
const groupStore = useGroupStore();
|
||||
const vrStore = useVrStore();
|
||||
const state = {
|
||||
nextCurrentUserRefresh: 300,
|
||||
@@ -152,7 +146,7 @@ export const useUpdateLoopStore = defineStore('UpdateLoop', () => {
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
friendStore.isRefreshFriendsLoading = false;
|
||||
friendStore.setIsRefreshFriendsLoading(false);
|
||||
console.error(err);
|
||||
}
|
||||
workerTimers.setTimeout(() => updateLoop(), 1000);
|
||||
|
||||
@@ -12,13 +12,12 @@ import {
|
||||
parseLocation,
|
||||
replaceBioSymbols
|
||||
} from '../shared/utils';
|
||||
import { getAllUserMemos, getUserMemo } from '../coordinators/memoCoordinator';
|
||||
import { getAllUserMemos } from '../coordinators/memoCoordinator';
|
||||
import { instanceRequest, userRequest } from '../api';
|
||||
import { AppDebug } from '../services/appConfig';
|
||||
import { database } from '../services/database';
|
||||
import { runUpdateCurrentUserLocationFlow } from '../coordinators/locationCoordinator';
|
||||
import { useAppearanceSettingsStore } from './settings/appearance';
|
||||
import { useFavoriteStore } from './favorite';
|
||||
import { useFriendStore } from './friend';
|
||||
import { useInstanceStore } from './instance';
|
||||
import { useLocationStore } from './location';
|
||||
@@ -30,7 +29,6 @@ import * as workerTimers from 'worker-timers';
|
||||
export const useUserStore = defineStore('User', () => {
|
||||
const appearanceSettingsStore = useAppearanceSettingsStore();
|
||||
const friendStore = useFriendStore();
|
||||
const favoriteStore = useFavoriteStore();
|
||||
const locationStore = useLocationStore();
|
||||
const instanceStore = useInstanceStore();
|
||||
const uiStore = useUiStore();
|
||||
@@ -657,6 +655,27 @@ export const useUserStore = defineStore('User', () => {
|
||||
currentUser.value.$travelingToTime = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {object} value
|
||||
*/
|
||||
function setCurrentUser(value) {
|
||||
currentUser.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {object} value
|
||||
*/
|
||||
function setSubsetOfLanguages(value) {
|
||||
subsetOfLanguages.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Array} value
|
||||
*/
|
||||
function setLanguageDialogLanguages(value) {
|
||||
languageDialog.value.languages = value;
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
function markCurrentUserGameStarted() {
|
||||
@@ -715,6 +734,9 @@ export const useUserStore = defineStore('User', () => {
|
||||
setCurrentUserColour,
|
||||
setCurrentUserLocationState,
|
||||
setCurrentUserTravelingToTime,
|
||||
setCurrentUser,
|
||||
setSubsetOfLanguages,
|
||||
setLanguageDialogLanguages,
|
||||
markCurrentUserGameStarted,
|
||||
markCurrentUserGameStopped,
|
||||
checkNote,
|
||||
|
||||
@@ -17,21 +17,16 @@ import {
|
||||
import { debounce, parseLocation } from '../shared/utils';
|
||||
import { AppDebug } from '../services/appConfig';
|
||||
import { database } from '../services/database';
|
||||
import { failedGetRequests } from '../services/request';
|
||||
import { refreshCustomScript } from '../shared/utils/base/ui';
|
||||
import { useAdvancedSettingsStore } from './settings/advanced';
|
||||
import { useAvatarProviderStore } from './avatarProvider';
|
||||
import { useAvatarStore } from './avatar';
|
||||
import {
|
||||
addLocalWorldFavorite,
|
||||
addLocalAvatarFavorite
|
||||
} from '../coordinators/favoriteCoordinator';
|
||||
import { useFavoriteStore } from './favorite';
|
||||
import { useFriendStore } from './friend';
|
||||
import { useGalleryStore } from './gallery';
|
||||
import { useGameLogStore } from './gameLog';
|
||||
import { useGameStore } from './game';
|
||||
import { useGroupStore } from './group';
|
||||
import { showGroupDialog } from '../coordinators/groupCoordinator';
|
||||
import { showWorldDialog } from '../coordinators/worldCoordinator';
|
||||
import {
|
||||
@@ -40,7 +35,6 @@ import {
|
||||
selectAvatarWithoutConfirmation
|
||||
} from '../coordinators/avatarCoordinator';
|
||||
import { showUserDialog, addCustomTag } from '../coordinators/userCoordinator';
|
||||
import { useInstanceStore } from './instance';
|
||||
import { useLocationStore } from './location';
|
||||
import { useModalStore } from './modal';
|
||||
import { useNotificationStore } from './notification';
|
||||
@@ -49,7 +43,6 @@ import { useSearchStore } from './search';
|
||||
import { useUpdateLoopStore } from './updateLoop';
|
||||
import { useUserStore } from './user';
|
||||
import { useVrcStatusStore } from './vrcStatus';
|
||||
import { useWorldStore } from './world';
|
||||
import { clearVRCXCache } from '../coordinators/vrcxCoordinator';
|
||||
import { watchState } from '../services/watchState';
|
||||
|
||||
@@ -59,12 +52,8 @@ export const useVrcxStore = defineStore('Vrcx', () => {
|
||||
const gameStore = useGameStore();
|
||||
const locationStore = useLocationStore();
|
||||
const notificationStore = useNotificationStore();
|
||||
const avatarStore = useAvatarStore();
|
||||
const worldStore = useWorldStore();
|
||||
const instanceStore = useInstanceStore();
|
||||
const friendStore = useFriendStore();
|
||||
|
||||
const favoriteStore = useFavoriteStore();
|
||||
const groupStore = useGroupStore();
|
||||
const userStore = useUserStore();
|
||||
const photonStore = usePhotonStore();
|
||||
const advancedSettingsStore = useAdvancedSettingsStore();
|
||||
@@ -73,7 +62,6 @@ export const useVrcxStore = defineStore('Vrcx', () => {
|
||||
const gameLogStore = useGameLogStore();
|
||||
const updateLoopStore = useUpdateLoopStore();
|
||||
const vrcStatusStore = useVrcStatusStore();
|
||||
const galleryStore = useGalleryStore();
|
||||
const { t } = useI18n();
|
||||
const modalStore = useModalStore();
|
||||
|
||||
@@ -279,10 +267,6 @@ export const useVrcxStore = defineStore('Vrcx', () => {
|
||||
searchLimit.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @param data
|
||||
@@ -644,10 +628,12 @@ export const useVrcxStore = defineStore('Vrcx', () => {
|
||||
toast.error('Invalid local favorite world command');
|
||||
break;
|
||||
}
|
||||
queryRequest.fetch('world.location', { worldId: id }).then(() => {
|
||||
searchStore.directAccessWorld(id);
|
||||
addLocalWorldFavorite(id, group);
|
||||
});
|
||||
queryRequest
|
||||
.fetch('world.location', { worldId: id })
|
||||
.then(() => {
|
||||
searchStore.directAccessWorld(id);
|
||||
addLocalWorldFavorite(id, group);
|
||||
});
|
||||
break;
|
||||
case 'local-favorite-avatar':
|
||||
console.log('local-favorite-avatar', commandArg);
|
||||
|
||||
Reference in New Issue
Block a user