mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-07 14:56:06 +02:00
reactive
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import { nextTick, ref, watch } from 'vue';
|
import { nextTick, reactive, ref, watch } from 'vue';
|
||||||
import { ElMessage, ElMessageBox } from 'element-plus';
|
import { ElMessage, ElMessageBox } from 'element-plus';
|
||||||
import { defineStore } from 'pinia';
|
import { defineStore } from 'pinia';
|
||||||
|
|
||||||
@@ -59,7 +59,7 @@ export const useAvatarStore = defineStore('Avatar', () => {
|
|||||||
cachePath: '',
|
cachePath: '',
|
||||||
fileAnalysis: []
|
fileAnalysis: []
|
||||||
});
|
});
|
||||||
const avatarHistory = ref(new Set());
|
const avatarHistory = reactive(new Set());
|
||||||
const avatarHistoryArray = ref([]);
|
const avatarHistoryArray = ref([]);
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
@@ -69,7 +69,7 @@ export const useAvatarStore = defineStore('Avatar', () => {
|
|||||||
cachedAvatars.clear();
|
cachedAvatars.clear();
|
||||||
cachedAvatarNames.clear();
|
cachedAvatarNames.clear();
|
||||||
cachedAvatarModerations.clear();
|
cachedAvatarModerations.clear();
|
||||||
avatarHistory.value.clear();
|
avatarHistory.clear();
|
||||||
avatarHistoryArray.value = [];
|
avatarHistoryArray.value = [];
|
||||||
if (isLoggedIn) {
|
if (isLoggedIn) {
|
||||||
getAvatarHistory();
|
getAvatarHistory();
|
||||||
@@ -339,7 +339,7 @@ export const useAvatarStore = defineStore('Avatar', () => {
|
|||||||
* @returns {Promise<void>}
|
* @returns {Promise<void>}
|
||||||
*/
|
*/
|
||||||
async function getAvatarHistory() {
|
async function getAvatarHistory() {
|
||||||
avatarHistory.value = new Set();
|
avatarHistory.clear();
|
||||||
const historyArray = await database.getAvatarHistory(
|
const historyArray = await database.getAvatarHistory(
|
||||||
userStore.currentUser.id
|
userStore.currentUser.id
|
||||||
);
|
);
|
||||||
@@ -349,7 +349,7 @@ export const useAvatarStore = defineStore('Avatar', () => {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
applyAvatar(avatar);
|
applyAvatar(avatar);
|
||||||
avatarHistory.value.add(avatar.id);
|
avatarHistory.add(avatar.id);
|
||||||
}
|
}
|
||||||
avatarHistoryArray.value = historyArray;
|
avatarHistoryArray.value = historyArray;
|
||||||
}
|
}
|
||||||
@@ -378,8 +378,8 @@ export const useAvatarStore = defineStore('Avatar', () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
avatarHistoryArray.value.unshift(ref);
|
avatarHistoryArray.value.unshift(ref);
|
||||||
avatarHistory.value.delete(ref.id);
|
avatarHistory.delete(ref.id);
|
||||||
avatarHistory.value.add(ref.id);
|
avatarHistory.add(ref.id);
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.error('Failed to add avatar to history:', err);
|
console.error('Failed to add avatar to history:', err);
|
||||||
@@ -387,7 +387,7 @@ export const useAvatarStore = defineStore('Avatar', () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function clearAvatarHistory() {
|
function clearAvatarHistory() {
|
||||||
avatarHistory.value = new Set();
|
avatarHistory.clear();
|
||||||
avatarHistoryArray.value = [];
|
avatarHistoryArray.value = [];
|
||||||
database.clearAvatarHistory();
|
database.clearAvatarHistory();
|
||||||
}
|
}
|
||||||
|
|||||||
+35
-35
@@ -53,9 +53,9 @@ export const useFriendStore = defineStore('Friend', () => {
|
|||||||
|
|
||||||
let friendLog = new Map();
|
let friendLog = new Map();
|
||||||
|
|
||||||
const friends = ref(new Map());
|
const friends = reactive(new Map());
|
||||||
|
|
||||||
const localFavoriteFriends = ref(new Set());
|
const localFavoriteFriends = reactive(new Set());
|
||||||
|
|
||||||
const isRefreshFriendsLoading = ref(false);
|
const isRefreshFriendsLoading = ref(false);
|
||||||
const onlineFriendCount = ref(0);
|
const onlineFriendCount = ref(0);
|
||||||
@@ -96,7 +96,7 @@ export const useFriendStore = defineStore('Friend', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const vipFriends = computed(() => {
|
const vipFriends = computed(() => {
|
||||||
return Array.from(friends.value.values())
|
return Array.from(friends.values())
|
||||||
.filter((f) => f.state === 'online' && f.isVIP)
|
.filter((f) => f.state === 'online' && f.isVIP)
|
||||||
.sort(
|
.sort(
|
||||||
getFriendsSortFunction(
|
getFriendsSortFunction(
|
||||||
@@ -106,7 +106,7 @@ export const useFriendStore = defineStore('Friend', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const onlineFriends = computed(() => {
|
const onlineFriends = computed(() => {
|
||||||
return Array.from(friends.value.values())
|
return Array.from(friends.values())
|
||||||
.filter((f) => f.state === 'online' && !f.isVIP)
|
.filter((f) => f.state === 'online' && !f.isVIP)
|
||||||
.sort(
|
.sort(
|
||||||
getFriendsSortFunction(
|
getFriendsSortFunction(
|
||||||
@@ -116,7 +116,7 @@ export const useFriendStore = defineStore('Friend', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const activeFriends = computed(() => {
|
const activeFriends = computed(() => {
|
||||||
return Array.from(friends.value.values())
|
return Array.from(friends.values())
|
||||||
.filter((f) => f.state === 'active')
|
.filter((f) => f.state === 'active')
|
||||||
.sort(
|
.sort(
|
||||||
getFriendsSortFunction(
|
getFriendsSortFunction(
|
||||||
@@ -126,7 +126,7 @@ export const useFriendStore = defineStore('Friend', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const offlineFriends = computed(() => {
|
const offlineFriends = computed(() => {
|
||||||
return Array.from(friends.value.values())
|
return Array.from(friends.values())
|
||||||
.filter((f) => f.state === 'offline' || !f.state)
|
.filter((f) => f.state === 'offline' || !f.state)
|
||||||
.sort(
|
.sort(
|
||||||
getFriendsSortFunction(
|
getFriendsSortFunction(
|
||||||
@@ -138,7 +138,7 @@ export const useFriendStore = defineStore('Friend', () => {
|
|||||||
watch(
|
watch(
|
||||||
() => watchState.isLoggedIn,
|
() => watchState.isLoggedIn,
|
||||||
(isLoggedIn) => {
|
(isLoggedIn) => {
|
||||||
friends.value.clear();
|
friends.clear();
|
||||||
state.friendNumber = 0;
|
state.friendNumber = 0;
|
||||||
friendLog.clear();
|
friendLog.clear();
|
||||||
friendLogTable.value.data = [];
|
friendLogTable.value.data = [];
|
||||||
@@ -241,7 +241,7 @@ export const useFriendStore = defineStore('Friend', () => {
|
|||||||
|
|
||||||
function updateLocalFavoriteFriends() {
|
function updateLocalFavoriteFriends() {
|
||||||
const favoriteStore = useFavoriteStore();
|
const favoriteStore = useFavoriteStore();
|
||||||
localFavoriteFriends.value.clear();
|
localFavoriteFriends.clear();
|
||||||
for (const ref of favoriteStore.cachedFavorites.values()) {
|
for (const ref of favoriteStore.cachedFavorites.values()) {
|
||||||
if (
|
if (
|
||||||
!ref.$isDeleted &&
|
!ref.$isDeleted &&
|
||||||
@@ -252,15 +252,15 @@ export const useFriendStore = defineStore('Friend', () => {
|
|||||||
generalSettingsStore.localFavoriteFriendsGroups.length ===
|
generalSettingsStore.localFavoriteFriendsGroups.length ===
|
||||||
0)
|
0)
|
||||||
) {
|
) {
|
||||||
localFavoriteFriends.value.add(ref.favoriteId);
|
localFavoriteFriends.add(ref.favoriteId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
updateSidebarFriendsList();
|
updateSidebarFriendsList();
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateSidebarFriendsList() {
|
function updateSidebarFriendsList() {
|
||||||
for (const ctx of friends.value.values()) {
|
for (const ctx of friends.values()) {
|
||||||
const isVIP = localFavoriteFriends.value.has(ctx.id);
|
const isVIP = localFavoriteFriends.has(ctx.id);
|
||||||
if (ctx.isVIP === isVIP) {
|
if (ctx.isVIP === isVIP) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -275,7 +275,7 @@ export const useFriendStore = defineStore('Friend', () => {
|
|||||||
* @param {string?} stateInput
|
* @param {string?} stateInput
|
||||||
*/
|
*/
|
||||||
function updateFriend(id, stateInput = undefined) {
|
function updateFriend(id, stateInput = undefined) {
|
||||||
const ctx = friends.value.get(id);
|
const ctx = friends.get(id);
|
||||||
if (typeof ctx === 'undefined') {
|
if (typeof ctx === 'undefined') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -294,7 +294,7 @@ export const useFriendStore = defineStore('Friend', () => {
|
|||||||
ctx.pendingOffline = false;
|
ctx.pendingOffline = false;
|
||||||
ctx.pendingOfflineTime = '';
|
ctx.pendingOfflineTime = '';
|
||||||
}
|
}
|
||||||
const isVIP = localFavoriteFriends.value.has(id);
|
const isVIP = localFavoriteFriends.has(id);
|
||||||
let location = '';
|
let location = '';
|
||||||
let $location_at = undefined;
|
let $location_at = undefined;
|
||||||
if (typeof ref !== 'undefined') {
|
if (typeof ref !== 'undefined') {
|
||||||
@@ -439,11 +439,11 @@ export const useFriendStore = defineStore('Friend', () => {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!friends.value.has(id)) {
|
if (!friends.has(id)) {
|
||||||
console.log('Friend not found', id);
|
console.log('Friend not found', id);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const isVIP = localFavoriteFriends.value.has(id);
|
const isVIP = localFavoriteFriends.has(id);
|
||||||
const ref = ctx.ref;
|
const ref = ctx.ref;
|
||||||
if (ctx.state !== newState && typeof ctx.ref !== 'undefined') {
|
if (ctx.state !== newState && typeof ctx.ref !== 'undefined') {
|
||||||
if (
|
if (
|
||||||
@@ -515,11 +515,11 @@ export const useFriendStore = defineStore('Friend', () => {
|
|||||||
* @param {string} id
|
* @param {string} id
|
||||||
*/
|
*/
|
||||||
function deleteFriend(id) {
|
function deleteFriend(id) {
|
||||||
const ctx = friends.value.get(id);
|
const ctx = friends.get(id);
|
||||||
if (typeof ctx === 'undefined') {
|
if (typeof ctx === 'undefined') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
friends.value.delete(id);
|
friends.delete(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -543,13 +543,13 @@ export const useFriendStore = defineStore('Friend', () => {
|
|||||||
}
|
}
|
||||||
for (const friend of map) {
|
for (const friend of map) {
|
||||||
const [id, state_input] = friend;
|
const [id, state_input] = friend;
|
||||||
if (friends.value.has(id)) {
|
if (friends.has(id)) {
|
||||||
updateFriend(id, state_input);
|
updateFriend(id, state_input);
|
||||||
} else {
|
} else {
|
||||||
addFriend(id, state_input);
|
addFriend(id, state_input);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (id of friends.value.keys()) {
|
for (id of friends.keys()) {
|
||||||
if (map.has(id) === false) {
|
if (map.has(id) === false) {
|
||||||
deleteFriend(id);
|
deleteFriend(id);
|
||||||
}
|
}
|
||||||
@@ -561,11 +561,11 @@ export const useFriendStore = defineStore('Friend', () => {
|
|||||||
* @param {string?} state_input
|
* @param {string?} state_input
|
||||||
*/
|
*/
|
||||||
function addFriend(id, state_input = undefined) {
|
function addFriend(id, state_input = undefined) {
|
||||||
if (friends.value.has(id)) {
|
if (friends.has(id)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const ref = userStore.cachedUsers.get(id);
|
const ref = userStore.cachedUsers.get(id);
|
||||||
const isVIP = localFavoriteFriends.value.has(id);
|
const isVIP = localFavoriteFriends.has(id);
|
||||||
let name = '';
|
let name = '';
|
||||||
const friend = friendLog.get(id);
|
const friend = friendLog.get(id);
|
||||||
if (friend) {
|
if (friend) {
|
||||||
@@ -603,7 +603,7 @@ export const useFriendStore = defineStore('Friend', () => {
|
|||||||
} else {
|
} else {
|
||||||
ctx.name = ref.name;
|
ctx.name = ref.name;
|
||||||
}
|
}
|
||||||
friends.value.set(id, ctx);
|
friends.set(id, ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -731,7 +731,7 @@ export const useFriendStore = defineStore('Friend', () => {
|
|||||||
} else if (friend.platform) {
|
} else if (friend.platform) {
|
||||||
state_input = 'online';
|
state_input = 'online';
|
||||||
}
|
}
|
||||||
const ref = friends.value.get(friend.id);
|
const ref = friends.get(friend.id);
|
||||||
if (ref?.state !== state_input) {
|
if (ref?.state !== state_input) {
|
||||||
if (AppDebug.debugFriendState) {
|
if (AppDebug.debugFriendState) {
|
||||||
console.log(
|
console.log(
|
||||||
@@ -815,7 +815,7 @@ export const useFriendStore = defineStore('Friend', () => {
|
|||||||
let item;
|
let item;
|
||||||
const userIds = [];
|
const userIds = [];
|
||||||
const displayNames = [];
|
const displayNames = [];
|
||||||
for (const ctx of friends.value.values()) {
|
for (const ctx of friends.values()) {
|
||||||
userIds.push(ctx.id);
|
userIds.push(ctx.id);
|
||||||
if (ctx.ref?.displayName) {
|
if (ctx.ref?.displayName) {
|
||||||
displayNames.push(ctx.ref.displayName);
|
displayNames.push(ctx.ref.displayName);
|
||||||
@@ -833,7 +833,7 @@ export const useFriendStore = defineStore('Friend', () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const ref of friends.value.values()) {
|
for (const ref of friends.values()) {
|
||||||
if (ref?.ref?.id && ref.ref.displayName) {
|
if (ref?.ref?.id && ref.ref.displayName) {
|
||||||
friendsByDisplayName.set(ref.ref.displayName, ref.id);
|
friendsByDisplayName.set(ref.ref.displayName, ref.id);
|
||||||
}
|
}
|
||||||
@@ -870,7 +870,7 @@ export const useFriendStore = defineStore('Friend', () => {
|
|||||||
friendListMap.set(item.userId, friend);
|
friendListMap.set(item.userId, friend);
|
||||||
}
|
}
|
||||||
for (item of friendListMap.values()) {
|
for (item of friendListMap.values()) {
|
||||||
ref = friends.value.get(item.userId);
|
ref = friends.get(item.userId);
|
||||||
if (ref?.ref) {
|
if (ref?.ref) {
|
||||||
ref.ref.$joinCount = item.joinCount;
|
ref.ref.$joinCount = item.joinCount;
|
||||||
ref.ref.$lastSeen = item.lastSeen;
|
ref.ref.$lastSeen = item.lastSeen;
|
||||||
@@ -909,7 +909,7 @@ export const useFriendStore = defineStore('Friend', () => {
|
|||||||
handleFriendStatus(args);
|
handleFriendStatus(args);
|
||||||
if (args.json.isFriend && !friendLog.has(id)) {
|
if (args.json.isFriend && !friendLog.has(id)) {
|
||||||
if (state.friendNumber === 0) {
|
if (state.friendNumber === 0) {
|
||||||
state.friendNumber = friends.value.size;
|
state.friendNumber = friends.size;
|
||||||
}
|
}
|
||||||
ref.$friendNumber = ++state.friendNumber;
|
ref.$friendNumber = ++state.friendNumber;
|
||||||
configRepository.setInt(
|
configRepository.setInt(
|
||||||
@@ -1218,7 +1218,7 @@ export const useFriendStore = defineStore('Friend', () => {
|
|||||||
ref.friendNumber = friendNumber;
|
ref.friendNumber = friendNumber;
|
||||||
friendLog.set(ref.userId, ref);
|
friendLog.set(ref.userId, ref);
|
||||||
database.setFriendLogCurrent(ref);
|
database.setFriendLogCurrent(ref);
|
||||||
const friendRef = friends.value.get(userId);
|
const friendRef = friends.get(userId);
|
||||||
if (friendRef?.ref) {
|
if (friendRef?.ref) {
|
||||||
friendRef.ref.$friendNumber = friendNumber;
|
friendRef.ref.$friendNumber = friendNumber;
|
||||||
}
|
}
|
||||||
@@ -1246,7 +1246,7 @@ export const useFriendStore = defineStore('Friend', () => {
|
|||||||
setFriendNumber(state.friendNumber, userId);
|
setFriendNumber(state.friendNumber, userId);
|
||||||
}
|
}
|
||||||
if (state.friendNumber === 0) {
|
if (state.friendNumber === 0) {
|
||||||
state.friendNumber = friends.value.size;
|
state.friendNumber = friends.size;
|
||||||
}
|
}
|
||||||
console.log('Applied friend order from API', state.friendNumber);
|
console.log('Applied friend order from API', state.friendNumber);
|
||||||
await configRepository.setInt(
|
await configRepository.setInt(
|
||||||
@@ -1359,7 +1359,7 @@ export const useFriendStore = defineStore('Friend', () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function applyFriendLogFriendOrderInReverse() {
|
function applyFriendLogFriendOrderInReverse() {
|
||||||
state.friendNumber = friends.value.size + 1;
|
state.friendNumber = friends.size + 1;
|
||||||
const friendLogTable = getFriendLogFriendOrder();
|
const friendLogTable = getFriendLogFriendOrder();
|
||||||
for (let i = friendLogTable.length - 1; i > -1; i--) {
|
for (let i = friendLogTable.length - 1; i > -1; i--) {
|
||||||
const friendLogEntry = friendLogTable[i];
|
const friendLogEntry = friendLogTable[i];
|
||||||
@@ -1373,12 +1373,12 @@ export const useFriendStore = defineStore('Friend', () => {
|
|||||||
ref.friendNumber = --state.friendNumber;
|
ref.friendNumber = --state.friendNumber;
|
||||||
friendLog.set(ref.userId, ref);
|
friendLog.set(ref.userId, ref);
|
||||||
database.setFriendLogCurrent(ref);
|
database.setFriendLogCurrent(ref);
|
||||||
const friendRef = friends.value.get(friendLogEntry.id);
|
const friendRef = friends.get(friendLogEntry.id);
|
||||||
if (friendRef?.ref) {
|
if (friendRef?.ref) {
|
||||||
friendRef.ref.$friendNumber = ref.friendNumber;
|
friendRef.ref.$friendNumber = ref.friendNumber;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
state.friendNumber = friends.value.size;
|
state.friendNumber = friends.size;
|
||||||
console.log('Applied friend order from friendLog');
|
console.log('Applied friend order from friendLog');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1412,7 +1412,7 @@ export const useFriendStore = defineStore('Friend', () => {
|
|||||||
const backupTable = [];
|
const backupTable = [];
|
||||||
for (i = 0; i < backupUserIds.length; i++) {
|
for (i = 0; i < backupUserIds.length; i++) {
|
||||||
const userId = backupUserIds[i];
|
const userId = backupUserIds[i];
|
||||||
const ctx = friends.value.get(userId);
|
const ctx = friends.get(userId);
|
||||||
if (ctx) {
|
if (ctx) {
|
||||||
backupTable.push({
|
backupTable.push({
|
||||||
id: ctx.id,
|
id: ctx.id,
|
||||||
@@ -1471,7 +1471,7 @@ export const useFriendStore = defineStore('Friend', () => {
|
|||||||
function applyFriendOrderBackup(userIdOrder) {
|
function applyFriendOrderBackup(userIdOrder) {
|
||||||
for (let i = 0; i < userIdOrder.length; i++) {
|
for (let i = 0; i < userIdOrder.length; i++) {
|
||||||
const userId = userIdOrder[i];
|
const userId = userIdOrder[i];
|
||||||
const ctx = friends.value.get(userId);
|
const ctx = friends.get(userId);
|
||||||
const ref = ctx?.ref;
|
const ref = ctx?.ref;
|
||||||
if (!ref || ref.$friendNumber) {
|
if (!ref || ref.$friendNumber) {
|
||||||
continue;
|
continue;
|
||||||
@@ -1504,7 +1504,7 @@ export const useFriendStore = defineStore('Friend', () => {
|
|||||||
ref.friendNumber = ++state.friendNumber;
|
ref.friendNumber = ++state.friendNumber;
|
||||||
friendLog.set(ref.userId, ref);
|
friendLog.set(ref.userId, ref);
|
||||||
database.setFriendLogCurrent(ref);
|
database.setFriendLogCurrent(ref);
|
||||||
const friendRef = friends.value.get(friendLogEntry.id);
|
const friendRef = friends.get(friendLogEntry.id);
|
||||||
if (friendRef?.ref) {
|
if (friendRef?.ref) {
|
||||||
friendRef.ref.$friendNumber = ref.friendNumber;
|
friendRef.ref.$friendNumber = ref.friendNumber;
|
||||||
}
|
}
|
||||||
|
|||||||
+19
-19
@@ -1,4 +1,4 @@
|
|||||||
import { nextTick, ref, watch } from 'vue';
|
import { nextTick, reactive, ref, watch } from 'vue';
|
||||||
import { ElMessage, ElMessageBox } from 'element-plus';
|
import { ElMessage, ElMessageBox } from 'element-plus';
|
||||||
import { defineStore } from 'pinia';
|
import { defineStore } from 'pinia';
|
||||||
|
|
||||||
@@ -63,7 +63,7 @@ export const useGroupStore = defineStore('Group', () => {
|
|||||||
galleries: {}
|
galleries: {}
|
||||||
});
|
});
|
||||||
|
|
||||||
const currentUserGroups = ref(new Map());
|
const currentUserGroups = reactive(new Map());
|
||||||
|
|
||||||
const inviteGroupDialog = ref({
|
const inviteGroupDialog = ref({
|
||||||
visible: false,
|
visible: false,
|
||||||
@@ -111,7 +111,7 @@ export const useGroupStore = defineStore('Group', () => {
|
|||||||
groupMemberModeration.value.visible = false;
|
groupMemberModeration.value.visible = false;
|
||||||
currentUserGroupsInit.value = false;
|
currentUserGroupsInit.value = false;
|
||||||
cachedGroups.clear();
|
cachedGroups.clear();
|
||||||
currentUserGroups.value.clear();
|
currentUserGroups.clear();
|
||||||
if (isLoggedIn) {
|
if (isLoggedIn) {
|
||||||
initUserGroups();
|
initUserGroups();
|
||||||
}
|
}
|
||||||
@@ -235,7 +235,7 @@ export const useGroupStore = defineStore('Group', () => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const groups = [];
|
const groups = [];
|
||||||
for (const ref of currentUserGroups.value.values()) {
|
for (const ref of currentUserGroups.values()) {
|
||||||
groups.push({
|
groups.push({
|
||||||
id: ref.id,
|
id: ref.id,
|
||||||
name: ref.name,
|
name: ref.name,
|
||||||
@@ -308,11 +308,11 @@ export const useGroupStore = defineStore('Group', () => {
|
|||||||
|
|
||||||
// update group list
|
// update group list
|
||||||
for (const groupId of groups) {
|
for (const groupId of groups) {
|
||||||
if (!currentUserGroups.value.has(groupId)) {
|
if (!currentUserGroups.has(groupId)) {
|
||||||
onGroupJoined(groupId);
|
onGroupJoined(groupId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (const groupId of currentUserGroups.value.keys()) {
|
for (const groupId of currentUserGroups.keys()) {
|
||||||
if (!groups.includes(groupId)) {
|
if (!groups.includes(groupId)) {
|
||||||
onGroupLeft(groupId);
|
onGroupLeft(groupId);
|
||||||
}
|
}
|
||||||
@@ -324,8 +324,8 @@ export const useGroupStore = defineStore('Group', () => {
|
|||||||
* @param {string} groupId
|
* @param {string} groupId
|
||||||
*/
|
*/
|
||||||
function onGroupJoined(groupId) {
|
function onGroupJoined(groupId) {
|
||||||
if (!currentUserGroups.value.has(groupId)) {
|
if (!currentUserGroups.has(groupId)) {
|
||||||
currentUserGroups.value.set(groupId, {
|
currentUserGroups.set(groupId, {
|
||||||
id: groupId,
|
id: groupId,
|
||||||
name: '',
|
name: '',
|
||||||
iconUrl: ''
|
iconUrl: ''
|
||||||
@@ -348,8 +348,8 @@ export const useGroupStore = defineStore('Group', () => {
|
|||||||
if (groupDialog.value.visible && groupDialog.value.id === groupId) {
|
if (groupDialog.value.visible && groupDialog.value.id === groupId) {
|
||||||
showGroupDialog(groupId);
|
showGroupDialog(groupId);
|
||||||
}
|
}
|
||||||
if (currentUserGroups.value.has(groupId)) {
|
if (currentUserGroups.has(groupId)) {
|
||||||
currentUserGroups.value.delete(groupId);
|
currentUserGroups.delete(groupId);
|
||||||
groupRequest.getCachedGroup({ groupId }).then((args) => {
|
groupRequest.getCachedGroup({ groupId }).then((args) => {
|
||||||
groupChange(args.ref, 'Left group');
|
groupChange(args.ref, 'Left group');
|
||||||
});
|
});
|
||||||
@@ -633,7 +633,7 @@ export const useGroupStore = defineStore('Group', () => {
|
|||||||
};
|
};
|
||||||
cachedGroups.set(ref.id, ref);
|
cachedGroups.set(ref.id, ref);
|
||||||
} else {
|
} else {
|
||||||
if (currentUserGroups.value.has(ref.id)) {
|
if (currentUserGroups.has(ref.id)) {
|
||||||
// compare group props
|
// compare group props
|
||||||
if (
|
if (
|
||||||
ref.ownerId &&
|
ref.ownerId &&
|
||||||
@@ -695,9 +695,9 @@ export const useGroupStore = defineStore('Group', () => {
|
|||||||
ref.$url = `https://vrc.group/${ref.shortCode}.${ref.discriminator}`;
|
ref.$url = `https://vrc.group/${ref.shortCode}.${ref.discriminator}`;
|
||||||
applyGroupLanguage(ref);
|
applyGroupLanguage(ref);
|
||||||
|
|
||||||
const currentUserGroupRef = currentUserGroups.value.get(ref.id);
|
const currentUserGroupRef = currentUserGroups.get(ref.id);
|
||||||
if (currentUserGroupRef) {
|
if (currentUserGroupRef) {
|
||||||
currentUserGroups.value.set(ref.id, ref);
|
currentUserGroups.set(ref.id, ref);
|
||||||
}
|
}
|
||||||
|
|
||||||
const D = groupDialog.value;
|
const D = groupDialog.value;
|
||||||
@@ -928,7 +928,7 @@ export const useGroupStore = defineStore('Group', () => {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
cachedGroups.clear();
|
cachedGroups.clear();
|
||||||
currentUserGroups.value.clear();
|
currentUserGroups.clear();
|
||||||
for (const group of savedGroups) {
|
for (const group of savedGroups) {
|
||||||
const json = {
|
const json = {
|
||||||
id: group.id,
|
id: group.id,
|
||||||
@@ -941,7 +941,7 @@ export const useGroupStore = defineStore('Group', () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
const ref = applyGroup(json);
|
const ref = applyGroup(json);
|
||||||
currentUserGroups.value.set(group.id, ref);
|
currentUserGroups.set(group.id, ref);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (groups) {
|
if (groups) {
|
||||||
@@ -962,7 +962,7 @@ export const useGroupStore = defineStore('Group', () => {
|
|||||||
includeRoles: true
|
includeRoles: true
|
||||||
});
|
});
|
||||||
const ref = applyGroup(args.json);
|
const ref = applyGroup(args.json);
|
||||||
currentUserGroups.value.set(groupId, ref);
|
currentUserGroups.set(groupId, ref);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
}
|
}
|
||||||
@@ -980,11 +980,11 @@ export const useGroupStore = defineStore('Group', () => {
|
|||||||
userId: userStore.currentUser.id
|
userId: userStore.currentUser.id
|
||||||
});
|
});
|
||||||
handleGroupList(args);
|
handleGroupList(args);
|
||||||
currentUserGroups.value.clear();
|
currentUserGroups.clear();
|
||||||
for (const group of args.json) {
|
for (const group of args.json) {
|
||||||
const ref = applyGroup(group);
|
const ref = applyGroup(group);
|
||||||
if (!currentUserGroups.value.has(group.id)) {
|
if (!currentUserGroups.has(group.id)) {
|
||||||
currentUserGroups.value.set(group.id, ref);
|
currentUserGroups.set(group.id, ref);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const args1 = await groupRequest.getGroupPermissions({
|
const args1 = await groupRequest.getGroupPermissions({
|
||||||
|
|||||||
+27
-21
@@ -73,13 +73,13 @@ export const useInstanceStore = defineStore('Instance', () => {
|
|||||||
|
|
||||||
const currentInstanceLocation = ref({});
|
const currentInstanceLocation = ref({});
|
||||||
|
|
||||||
const queuedInstances = ref(new Map());
|
const queuedInstances = reactive(new Map());
|
||||||
|
|
||||||
const previousInstancesInfoDialogVisible = ref(false);
|
const previousInstancesInfoDialogVisible = ref(false);
|
||||||
|
|
||||||
const previousInstancesInfoDialogInstanceId = ref('');
|
const previousInstancesInfoDialogInstanceId = ref('');
|
||||||
|
|
||||||
const instanceJoinHistory = ref(new Map());
|
let instanceJoinHistory = reactive(new Map());
|
||||||
|
|
||||||
const currentInstanceUsersData = ref([]);
|
const currentInstanceUsersData = ref([]);
|
||||||
const currentInstanceUsersTable = computed(() => {
|
const currentInstanceUsersTable = computed(() => {
|
||||||
@@ -103,10 +103,10 @@ export const useInstanceStore = defineStore('Instance', () => {
|
|||||||
() => watchState.isLoggedIn,
|
() => watchState.isLoggedIn,
|
||||||
(isLoggedIn) => {
|
(isLoggedIn) => {
|
||||||
currentInstanceUsersData.value = [];
|
currentInstanceUsersData.value = [];
|
||||||
instanceJoinHistory.value = new Map();
|
instanceJoinHistory.clear();
|
||||||
previousInstancesInfoDialogVisible.value = false;
|
previousInstancesInfoDialogVisible.value = false;
|
||||||
cachedInstances.clear();
|
cachedInstances.clear();
|
||||||
queuedInstances.value.clear();
|
queuedInstances.clear();
|
||||||
if (isLoggedIn) {
|
if (isLoggedIn) {
|
||||||
getInstanceJoinHistory();
|
getInstanceJoinHistory();
|
||||||
}
|
}
|
||||||
@@ -115,7 +115,13 @@ export const useInstanceStore = defineStore('Instance', () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
async function getInstanceJoinHistory() {
|
async function getInstanceJoinHistory() {
|
||||||
instanceJoinHistory.value = await database.getInstanceJoinHistory();
|
try {
|
||||||
|
instanceJoinHistory = reactive(
|
||||||
|
await database.getInstanceJoinHistory()
|
||||||
|
);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Failed to get instance join history:', error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function addInstanceJoinHistory(location, dateTime) {
|
function addInstanceJoinHistory(location, dateTime) {
|
||||||
@@ -123,12 +129,12 @@ export const useInstanceStore = defineStore('Instance', () => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (instanceJoinHistory.value.has(location)) {
|
if (instanceJoinHistory.has(location)) {
|
||||||
instanceJoinHistory.value.delete(location);
|
instanceJoinHistory.delete(location);
|
||||||
}
|
}
|
||||||
|
|
||||||
const epoch = new Date(dateTime).getTime();
|
const epoch = new Date(dateTime).getTime();
|
||||||
instanceJoinHistory.value.set(location, epoch);
|
instanceJoinHistory.set(location, epoch);
|
||||||
}
|
}
|
||||||
|
|
||||||
function showPreviousInstancesInfoDialog(instanceId) {
|
function showPreviousInstancesInfoDialog(instanceId) {
|
||||||
@@ -883,14 +889,14 @@ export const useInstanceStore = defineStore('Instance', () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function removeAllQueuedInstances() {
|
function removeAllQueuedInstances() {
|
||||||
queuedInstances.value.forEach((ref) => {
|
queuedInstances.forEach((ref) => {
|
||||||
ElMessage({
|
ElMessage({
|
||||||
message: `Removed instance ${ref.$worldName} from queue`,
|
message: `Removed instance ${ref.$worldName} from queue`,
|
||||||
type: 'info'
|
type: 'info'
|
||||||
});
|
});
|
||||||
ref.$msgBox?.close();
|
ref.$msgBox?.close();
|
||||||
});
|
});
|
||||||
queuedInstances.value.clear();
|
queuedInstances.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -898,10 +904,10 @@ export const useInstanceStore = defineStore('Instance', () => {
|
|||||||
* @param {string} instanceId
|
* @param {string} instanceId
|
||||||
*/
|
*/
|
||||||
function removeQueuedInstance(instanceId) {
|
function removeQueuedInstance(instanceId) {
|
||||||
const ref = queuedInstances.value.get(instanceId);
|
const ref = queuedInstances.get(instanceId);
|
||||||
if (typeof ref !== 'undefined') {
|
if (typeof ref !== 'undefined') {
|
||||||
ref.$msgBox.close();
|
ref.$msgBox.close();
|
||||||
queuedInstances.value.delete(instanceId);
|
queuedInstances.delete(instanceId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -910,7 +916,7 @@ export const useInstanceStore = defineStore('Instance', () => {
|
|||||||
* @param {string} instanceId
|
* @param {string} instanceId
|
||||||
*/
|
*/
|
||||||
function applyQueuedInstance(instanceId) {
|
function applyQueuedInstance(instanceId) {
|
||||||
queuedInstances.value.forEach((ref) => {
|
queuedInstances.forEach((ref) => {
|
||||||
if (ref.location !== instanceId) {
|
if (ref.location !== instanceId) {
|
||||||
ElMessage({
|
ElMessage({
|
||||||
message: t('message.instance.removed_form_queue', {
|
message: t('message.instance.removed_form_queue', {
|
||||||
@@ -919,13 +925,13 @@ export const useInstanceStore = defineStore('Instance', () => {
|
|||||||
type: 'info'
|
type: 'info'
|
||||||
});
|
});
|
||||||
ref.$msgBox?.close();
|
ref.$msgBox?.close();
|
||||||
queuedInstances.value.delete(ref.location);
|
queuedInstances.delete(ref.location);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (!instanceId) {
|
if (!instanceId) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!queuedInstances.value.has(instanceId)) {
|
if (!queuedInstances.has(instanceId)) {
|
||||||
const L = parseLocation(instanceId);
|
const L = parseLocation(instanceId);
|
||||||
if (L.isRealInstance) {
|
if (L.isRealInstance) {
|
||||||
instanceRequest
|
instanceRequest
|
||||||
@@ -958,10 +964,10 @@ export const useInstanceStore = defineStore('Instance', () => {
|
|||||||
* @param {string} instanceId
|
* @param {string} instanceId
|
||||||
*/
|
*/
|
||||||
function instanceQueueReady(instanceId) {
|
function instanceQueueReady(instanceId) {
|
||||||
const ref = queuedInstances.value.get(instanceId);
|
const ref = queuedInstances.get(instanceId);
|
||||||
if (typeof ref !== 'undefined') {
|
if (typeof ref !== 'undefined') {
|
||||||
ref.$msgBox.close();
|
ref.$msgBox.close();
|
||||||
queuedInstances.value.delete(instanceId);
|
queuedInstances.delete(instanceId);
|
||||||
}
|
}
|
||||||
const L = parseLocation(instanceId);
|
const L = parseLocation(instanceId);
|
||||||
const group = groupStore.cachedGroups.get(L.groupId);
|
const group = groupStore.cachedGroups.get(L.groupId);
|
||||||
@@ -1002,7 +1008,7 @@ export const useInstanceStore = defineStore('Instance', () => {
|
|||||||
* @returns {Promise<void>}
|
* @returns {Promise<void>}
|
||||||
*/
|
*/
|
||||||
async function instanceQueueUpdate(instanceId, position, queueSize) {
|
async function instanceQueueUpdate(instanceId, position, queueSize) {
|
||||||
let ref = queuedInstances.value.get(instanceId);
|
let ref = queuedInstances.get(instanceId);
|
||||||
if (typeof ref === 'undefined') {
|
if (typeof ref === 'undefined') {
|
||||||
ref = {
|
ref = {
|
||||||
$msgBox: null,
|
$msgBox: null,
|
||||||
@@ -1036,7 +1042,7 @@ export const useInstanceStore = defineStore('Instance', () => {
|
|||||||
showClose: true,
|
showClose: true,
|
||||||
customClass: 'vrc-instance-queue-message'
|
customClass: 'vrc-instance-queue-message'
|
||||||
});
|
});
|
||||||
queuedInstances.value.set(instanceId, ref);
|
queuedInstances.set(instanceId, ref);
|
||||||
// workerTimers.setTimeout(this.instanceQueueTimeout, 3600000);
|
// workerTimers.setTimeout(this.instanceQueueTimeout, 3600000);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1196,9 +1202,9 @@ export const useInstanceStore = defineStore('Instance', () => {
|
|||||||
|
|
||||||
// $app.methods.instanceQueueClear = function () {
|
// $app.methods.instanceQueueClear = function () {
|
||||||
// // remove all instances from queue
|
// // remove all instances from queue
|
||||||
// queuedInstances.value.forEach((ref) => {
|
// queuedInstances.forEach((ref) => {
|
||||||
// ref.$msgBox.close();
|
// ref.$msgBox.close();
|
||||||
// queuedInstances.value.delete(ref.location);
|
// queuedInstances.delete(ref.location);
|
||||||
// });
|
// });
|
||||||
// };
|
// };
|
||||||
|
|
||||||
|
|||||||
+16
-16
@@ -1,4 +1,4 @@
|
|||||||
import { ref, watch } from 'vue';
|
import { reactive, ref, watch } from 'vue';
|
||||||
import { defineStore } from 'pinia';
|
import { defineStore } from 'pinia';
|
||||||
|
|
||||||
import { avatarModerationRequest, playerModerationRequest } from '../api';
|
import { avatarModerationRequest, playerModerationRequest } from '../api';
|
||||||
@@ -10,8 +10,8 @@ export const useModerationStore = defineStore('Moderation', () => {
|
|||||||
const avatarStore = useAvatarStore();
|
const avatarStore = useAvatarStore();
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
|
|
||||||
const cachedPlayerModerations = ref(new Map());
|
const cachedPlayerModerations = reactive(new Map());
|
||||||
const cachedPlayerModerationsUserIds = ref(new Set());
|
const cachedPlayerModerationsUserIds = reactive(new Set());
|
||||||
const playerModerationTable = ref({
|
const playerModerationTable = ref({
|
||||||
data: [],
|
data: [],
|
||||||
search: '',
|
search: '',
|
||||||
@@ -46,8 +46,8 @@ export const useModerationStore = defineStore('Moderation', () => {
|
|||||||
watch(
|
watch(
|
||||||
() => watchState.isLoggedIn,
|
() => watchState.isLoggedIn,
|
||||||
(isLoggedIn) => {
|
(isLoggedIn) => {
|
||||||
cachedPlayerModerations.value.clear();
|
cachedPlayerModerations.clear();
|
||||||
cachedPlayerModerationsUserIds.value.clear();
|
cachedPlayerModerationsUserIds.clear();
|
||||||
playerModerationTable.value.loading = false;
|
playerModerationTable.value.loading = false;
|
||||||
playerModerationTable.value.data = [];
|
playerModerationTable.value.data = [];
|
||||||
if (isLoggedIn) {
|
if (isLoggedIn) {
|
||||||
@@ -61,14 +61,14 @@ export const useModerationStore = defineStore('Moderation', () => {
|
|||||||
const { ref } = args;
|
const { ref } = args;
|
||||||
|
|
||||||
let hasModeration = false;
|
let hasModeration = false;
|
||||||
for (const ref of cachedPlayerModerations.value.values()) {
|
for (const ref of cachedPlayerModerations.values()) {
|
||||||
if (ref.targetUserId === ref.targetUserId) {
|
if (ref.targetUserId === ref.targetUserId) {
|
||||||
hasModeration = true;
|
hasModeration = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!hasModeration) {
|
if (!hasModeration) {
|
||||||
cachedPlayerModerationsUserIds.value.delete(ref.targetUserId);
|
cachedPlayerModerationsUserIds.delete(ref.targetUserId);
|
||||||
}
|
}
|
||||||
|
|
||||||
const userRef = userStore.cachedUsers.get(ref.targetUserId);
|
const userRef = userStore.cachedUsers.get(ref.targetUserId);
|
||||||
@@ -109,13 +109,13 @@ export const useModerationStore = defineStore('Moderation', () => {
|
|||||||
function handlePlayerModerationDelete(args) {
|
function handlePlayerModerationDelete(args) {
|
||||||
let { type, moderated } = args.params;
|
let { type, moderated } = args.params;
|
||||||
const userId = userStore.currentUser.id;
|
const userId = userStore.currentUser.id;
|
||||||
for (let ref of cachedPlayerModerations.value.values()) {
|
for (let ref of cachedPlayerModerations.values()) {
|
||||||
if (
|
if (
|
||||||
ref.type === type &&
|
ref.type === type &&
|
||||||
ref.targetUserId === moderated &&
|
ref.targetUserId === moderated &&
|
||||||
ref.sourceUserId === userId
|
ref.sourceUserId === userId
|
||||||
) {
|
) {
|
||||||
cachedPlayerModerations.value.delete(ref.id);
|
cachedPlayerModerations.delete(ref.id);
|
||||||
handlePlayerModerationAtDelete({
|
handlePlayerModerationAtDelete({
|
||||||
ref,
|
ref,
|
||||||
params: {
|
params: {
|
||||||
@@ -133,7 +133,7 @@ export const useModerationStore = defineStore('Moderation', () => {
|
|||||||
* @returns {object}
|
* @returns {object}
|
||||||
*/
|
*/
|
||||||
function applyPlayerModeration(json) {
|
function applyPlayerModeration(json) {
|
||||||
let ref = cachedPlayerModerations.value.get(json.id);
|
let ref = cachedPlayerModerations.get(json.id);
|
||||||
if (typeof ref === 'undefined') {
|
if (typeof ref === 'undefined') {
|
||||||
ref = {
|
ref = {
|
||||||
id: '',
|
id: '',
|
||||||
@@ -148,13 +148,13 @@ export const useModerationStore = defineStore('Moderation', () => {
|
|||||||
//
|
//
|
||||||
...json
|
...json
|
||||||
};
|
};
|
||||||
cachedPlayerModerations.value.set(ref.id, ref);
|
cachedPlayerModerations.set(ref.id, ref);
|
||||||
} else {
|
} else {
|
||||||
Object.assign(ref, json);
|
Object.assign(ref, json);
|
||||||
ref.$isExpired = false;
|
ref.$isExpired = false;
|
||||||
}
|
}
|
||||||
if (json.targetUserId) {
|
if (json.targetUserId) {
|
||||||
cachedPlayerModerationsUserIds.value.add(json.targetUserId);
|
cachedPlayerModerationsUserIds.add(json.targetUserId);
|
||||||
}
|
}
|
||||||
const array = playerModerationTable.value.data;
|
const array = playerModerationTable.value.data;
|
||||||
const index = array.findIndex((item) => item.id === ref.id);
|
const index = array.findIndex((item) => item.id === ref.id);
|
||||||
@@ -171,14 +171,14 @@ export const useModerationStore = defineStore('Moderation', () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function expirePlayerModerations() {
|
function expirePlayerModerations() {
|
||||||
cachedPlayerModerationsUserIds.value.clear();
|
cachedPlayerModerationsUserIds.clear();
|
||||||
for (let ref of cachedPlayerModerations.value.values()) {
|
for (let ref of cachedPlayerModerations.values()) {
|
||||||
ref.$isExpired = true;
|
ref.$isExpired = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function deleteExpiredPlayerModerations() {
|
function deleteExpiredPlayerModerations() {
|
||||||
for (let ref of cachedPlayerModerations.value.values()) {
|
for (let ref of cachedPlayerModerations.values()) {
|
||||||
if (!ref.$isExpired) {
|
if (!ref.$isExpired) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -243,7 +243,7 @@ export const useModerationStore = defineStore('Moderation', () => {
|
|||||||
isAvatarInteractionDisabled: false,
|
isAvatarInteractionDisabled: false,
|
||||||
isChatBoxMuted: false
|
isChatBoxMuted: false
|
||||||
};
|
};
|
||||||
for (let ref of cachedPlayerModerations.value.values()) {
|
for (let ref of cachedPlayerModerations.values()) {
|
||||||
if (ref.targetUserId !== userId) {
|
if (ref.targetUserId !== userId) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ export const useAdvancedSettingsStore = defineStore('AdvancedSettings', () => {
|
|||||||
const ugcFolderPath = ref('');
|
const ugcFolderPath = ref('');
|
||||||
const autoDeleteOldPrints = ref(false);
|
const autoDeleteOldPrints = ref(false);
|
||||||
const notificationOpacity = ref(100);
|
const notificationOpacity = ref(100);
|
||||||
const currentUserInventory = ref(new Map());
|
const currentUserInventory = reactive(new Map());
|
||||||
const isVRChatConfigDialogVisible = ref(false);
|
const isVRChatConfigDialogVisible = ref(false);
|
||||||
const saveInstanceEmoji = ref(false);
|
const saveInstanceEmoji = ref(false);
|
||||||
const vrcRegistryAutoBackup = ref(true);
|
const vrcRegistryAutoBackup = ref(true);
|
||||||
@@ -62,7 +62,7 @@ export const useAdvancedSettingsStore = defineStore('AdvancedSettings', () => {
|
|||||||
watch(
|
watch(
|
||||||
() => watchState.isLoggedIn,
|
() => watchState.isLoggedIn,
|
||||||
() => {
|
() => {
|
||||||
currentUserInventory.value.clear();
|
currentUserInventory.clear();
|
||||||
isVRChatConfigDialogVisible.value = false;
|
isVRChatConfigDialogVisible.value = false;
|
||||||
},
|
},
|
||||||
{ flush: 'sync' }
|
{ flush: 'sync' }
|
||||||
|
|||||||
+15
-18
@@ -261,7 +261,7 @@ export const useUserStore = defineStore('User', () => {
|
|||||||
dateFriendedInfo: []
|
dateFriendedInfo: []
|
||||||
});
|
});
|
||||||
|
|
||||||
const currentTravelers = ref(new Map());
|
const currentTravelers = reactive(new Map());
|
||||||
const subsetOfLanguages = ref([]);
|
const subsetOfLanguages = ref([]);
|
||||||
const languageDialog = ref({
|
const languageDialog = ref({
|
||||||
visible: false,
|
visible: false,
|
||||||
@@ -284,8 +284,8 @@ export const useUserStore = defineStore('User', () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
const showUserDialogHistory = ref(new Set());
|
const showUserDialogHistory = reactive(new Set());
|
||||||
const customUserTags = ref(new Map());
|
const customUserTags = reactive(new Map());
|
||||||
|
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
instancePlayerCount: new Map(),
|
instancePlayerCount: new Map(),
|
||||||
@@ -304,10 +304,10 @@ export const useUserStore = defineStore('User', () => {
|
|||||||
() => watchState.isLoggedIn,
|
() => watchState.isLoggedIn,
|
||||||
(isLoggedIn) => {
|
(isLoggedIn) => {
|
||||||
if (!isLoggedIn) {
|
if (!isLoggedIn) {
|
||||||
currentTravelers.value.clear();
|
currentTravelers.clear();
|
||||||
showUserDialogHistory.value.clear();
|
showUserDialogHistory.clear();
|
||||||
state.instancePlayerCount.clear();
|
state.instancePlayerCount.clear();
|
||||||
customUserTags.value.clear();
|
customUserTags.clear();
|
||||||
state.notes.clear();
|
state.notes.clear();
|
||||||
pastDisplayNameTable.value.data = [];
|
pastDisplayNameTable.value.data = [];
|
||||||
subsetOfLanguages.value = [];
|
subsetOfLanguages.value = [];
|
||||||
@@ -511,7 +511,7 @@ export const useUserStore = defineStore('User', () => {
|
|||||||
newCount++;
|
newCount++;
|
||||||
state.instancePlayerCount.set(ref.location, newCount);
|
state.instancePlayerCount.set(ref.location, newCount);
|
||||||
}
|
}
|
||||||
const tag = customUserTags.value.get(json.id);
|
const tag = customUserTags.get(json.id);
|
||||||
if (tag) {
|
if (tag) {
|
||||||
ref.$customTag = tag.tag;
|
ref.$customTag = tag.tag;
|
||||||
ref.$customTagColour = tag.colour;
|
ref.$customTagColour = tag.colour;
|
||||||
@@ -582,23 +582,20 @@ export const useUserStore = defineStore('User', () => {
|
|||||||
// traveling
|
// traveling
|
||||||
if (ref.location === 'traveling') {
|
if (ref.location === 'traveling') {
|
||||||
ref.$location = parseLocation(ref.travelingToLocation);
|
ref.$location = parseLocation(ref.travelingToLocation);
|
||||||
if (
|
if (!currentTravelers.has(ref.id) && ref.travelingToLocation) {
|
||||||
!currentTravelers.value.has(ref.id) &&
|
|
||||||
ref.travelingToLocation
|
|
||||||
) {
|
|
||||||
const travelRef = reactive({
|
const travelRef = reactive({
|
||||||
created_at: new Date().toJSON(),
|
created_at: new Date().toJSON(),
|
||||||
...ref
|
...ref
|
||||||
});
|
});
|
||||||
currentTravelers.value.set(ref.id, travelRef);
|
currentTravelers.set(ref.id, travelRef);
|
||||||
sharedFeedStore.sharedFeed.pendingUpdate = true;
|
sharedFeedStore.sharedFeed.pendingUpdate = true;
|
||||||
sharedFeedStore.updateSharedFeed(false);
|
sharedFeedStore.updateSharedFeed(false);
|
||||||
onPlayerTraveling(travelRef);
|
onPlayerTraveling(travelRef);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ref.$location = parseLocation(ref.location);
|
ref.$location = parseLocation(ref.location);
|
||||||
if (currentTravelers.value.has(ref.id)) {
|
if (currentTravelers.has(ref.id)) {
|
||||||
currentTravelers.value.delete(ref.id);
|
currentTravelers.delete(ref.id);
|
||||||
sharedFeedStore.sharedFeed.pendingUpdate = true;
|
sharedFeedStore.sharedFeed.pendingUpdate = true;
|
||||||
sharedFeedStore.updateSharedFeed(false);
|
sharedFeedStore.updateSharedFeed(false);
|
||||||
}
|
}
|
||||||
@@ -946,8 +943,8 @@ export const useUserStore = defineStore('User', () => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
showUserDialogHistory.value.delete(userId);
|
showUserDialogHistory.delete(userId);
|
||||||
showUserDialogHistory.value.add(userId);
|
showUserDialogHistory.add(userId);
|
||||||
searchStore.quickSearchItems = searchStore.quickSearchUserHistory();
|
searchStore.quickSearchItems = searchStore.quickSearchUserHistory();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1576,12 +1573,12 @@ export const useUserStore = defineStore('User', () => {
|
|||||||
|
|
||||||
function addCustomTag(data) {
|
function addCustomTag(data) {
|
||||||
if (data.Tag) {
|
if (data.Tag) {
|
||||||
customUserTags.value.set(data.UserId, {
|
customUserTags.set(data.UserId, {
|
||||||
tag: data.Tag,
|
tag: data.Tag,
|
||||||
colour: data.TagColour
|
colour: data.TagColour
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
customUserTags.value.delete(data.UserId);
|
customUserTags.delete(data.UserId);
|
||||||
}
|
}
|
||||||
const feedUpdate = {
|
const feedUpdate = {
|
||||||
userId: data.UserId,
|
userId: data.UserId,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { nextTick, ref } from 'vue';
|
import { nextTick, reactive, ref } from 'vue';
|
||||||
|
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
|
|
||||||
@@ -8,7 +8,7 @@ import { getWorldName } from '../../../shared/utils';
|
|||||||
export function useInstanceActivityData() {
|
export function useInstanceActivityData() {
|
||||||
const activityData = ref([]);
|
const activityData = ref([]);
|
||||||
const activityDetailData = ref([]);
|
const activityDetailData = ref([]);
|
||||||
const allDateOfActivity = ref(new Set());
|
let allDateOfActivity = reactive(new Set());
|
||||||
const worldNameArray = ref([]);
|
const worldNameArray = ref([]);
|
||||||
|
|
||||||
async function getAllDateOfActivity() {
|
async function getAllDateOfActivity() {
|
||||||
@@ -24,7 +24,7 @@ export function useInstanceActivityData() {
|
|||||||
uniqueDates.add(formattedDate);
|
uniqueDates.add(formattedDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
allDateOfActivity.value = uniqueDates;
|
allDateOfActivity = reactive(uniqueDates);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getWorldNameData() {
|
async function getWorldNameData() {
|
||||||
|
|||||||
Reference in New Issue
Block a user