mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-17 22:03:50 +02:00
Fix moving favorites
This commit is contained in:
@@ -309,7 +309,7 @@ export function $throw(code, error, endpoint) {
|
||||
if (endpoint?.startsWith('analysis/')) {
|
||||
ignoreError = true;
|
||||
}
|
||||
if (endpoint.endsWith('/mutuals') && (code === 403 || code === -1)) {
|
||||
if (endpoint?.endsWith('/mutuals') && (code === 403 || code === -1)) {
|
||||
ignoreError = true;
|
||||
}
|
||||
const text = message.map((s) => escapeTag(s)).join('<br>');
|
||||
|
||||
@@ -728,6 +728,7 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
friendStore.updateLocalFavoriteFriends();
|
||||
isFavoriteLoading.value = false;
|
||||
watchState.isFavoritesLoaded = true;
|
||||
countFavoriteGroups();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -789,9 +790,8 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
friendStore.updateSidebarFavorites();
|
||||
}
|
||||
ref.$groupKey = `${ref.type}:${String(ref.tags[0])}`;
|
||||
const group = getCachedFavoriteGroupsByTypeName()[ref.$groupKey];
|
||||
if (typeof group !== 'undefined') {
|
||||
++group.count;
|
||||
if (!isFavoriteLoading.value) {
|
||||
countFavoriteGroups();
|
||||
}
|
||||
} else {
|
||||
if (ref.favoriteId !== json.favoriteId) {
|
||||
@@ -1631,6 +1631,7 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
handleFavoriteAdd,
|
||||
getCachedFavoritesByObjectId,
|
||||
checkInvalidLocalAvatars,
|
||||
removeInvalidLocalAvatars
|
||||
removeInvalidLocalAvatars,
|
||||
getCachedFavoriteGroupsByTypeName
|
||||
};
|
||||
});
|
||||
|
||||
@@ -83,14 +83,14 @@
|
||||
addFavoriteAvatar(groupAPI);
|
||||
}
|
||||
} else {
|
||||
moveFavorite(props.currentFavorite.ref, groupAPI, props.type);
|
||||
moveFavorite(props.currentFavorite.ref, groupAPI);
|
||||
}
|
||||
}
|
||||
|
||||
function moveFavorite(ref, group, type) {
|
||||
function moveFavorite(ref, group) {
|
||||
favoriteRequest.deleteFavorite({ objectId: ref.id }).then(() => {
|
||||
favoriteRequest.addFavorite({
|
||||
type,
|
||||
type: group.type,
|
||||
favoriteId: ref.id,
|
||||
tags: group.name
|
||||
});
|
||||
@@ -100,7 +100,7 @@
|
||||
function addFavoriteAvatar(groupAPI) {
|
||||
return favoriteRequest
|
||||
.addFavorite({
|
||||
type: 'avatar',
|
||||
type: groupAPI.type,
|
||||
favoriteId: props.currentFavorite.id,
|
||||
tags: groupAPI.name
|
||||
})
|
||||
|
||||
@@ -137,7 +137,7 @@
|
||||
const { showUserDialog } = useUserStore();
|
||||
const { favoriteAvatarGroups, avatarImportDialogInput, avatarImportDialogVisible, localAvatarFavoriteGroups } =
|
||||
storeToRefs(useFavoriteStore());
|
||||
const { addLocalAvatarFavorite, localAvatarFavGroupLength } = useFavoriteStore();
|
||||
const { addLocalAvatarFavorite, localAvatarFavGroupLength, getCachedFavoritesByObjectId } = useFavoriteStore();
|
||||
const { showAvatarDialog, applyAvatar } = useAvatarStore();
|
||||
const { showFullscreenImageDialog } = useGalleryStore();
|
||||
|
||||
@@ -302,7 +302,7 @@
|
||||
function addFavoriteAvatar(ref, group, message) {
|
||||
return favoriteRequest
|
||||
.addFavorite({
|
||||
type: 'avatar',
|
||||
type: group.type,
|
||||
favoriteId: ref.id,
|
||||
tags: group.name
|
||||
})
|
||||
@@ -329,6 +329,9 @@
|
||||
}
|
||||
ref = data[i];
|
||||
if (D.avatarImportFavoriteGroup) {
|
||||
if (getCachedFavoritesByObjectId(ref.id)) {
|
||||
throw new Error('Avatar is already in favorites');
|
||||
}
|
||||
await addFavoriteAvatar(ref, D.avatarImportFavoriteGroup, false);
|
||||
} else if (D.avatarImportLocalFavoriteGroup) {
|
||||
addLocalAvatarFavorite(ref.id, D.avatarImportLocalFavoriteGroup);
|
||||
|
||||
@@ -121,6 +121,7 @@
|
||||
const { favoriteFriendGroups, friendImportDialogInput, friendImportDialogVisible } =
|
||||
storeToRefs(useFavoriteStore());
|
||||
const { showFullscreenImageDialog } = useGalleryStore();
|
||||
const { getCachedFavoritesByObjectId } = useFavoriteStore();
|
||||
|
||||
const friendImportDialog = ref({
|
||||
loading: false,
|
||||
@@ -234,6 +235,9 @@
|
||||
break;
|
||||
}
|
||||
ref = data[i];
|
||||
if (getCachedFavoritesByObjectId(ref.id)) {
|
||||
throw new Error('Friend is already in favorites');
|
||||
}
|
||||
await addFavoriteUser(ref, D.friendImportFavoriteGroup, false);
|
||||
removeFromArray(friendImportTable.value.data, ref);
|
||||
D.userIdList.delete(ref.id);
|
||||
@@ -250,7 +254,7 @@
|
||||
function addFavoriteUser(ref, group, message) {
|
||||
return favoriteRequest
|
||||
.addFavorite({
|
||||
type: 'friend',
|
||||
type: group.type,
|
||||
favoriteId: ref.id,
|
||||
tags: group.name
|
||||
})
|
||||
|
||||
@@ -139,7 +139,7 @@
|
||||
const { showUserDialog } = useUserStore();
|
||||
const { favoriteWorldGroups, worldImportDialogInput, worldImportDialogVisible, localWorldFavoriteGroups } =
|
||||
storeToRefs(useFavoriteStore());
|
||||
const { localWorldFavGroupLength, addLocalWorldFavorite } = useFavoriteStore();
|
||||
const { localWorldFavGroupLength, addLocalWorldFavorite, getCachedFavoritesByObjectId } = useFavoriteStore();
|
||||
const { showWorldDialog } = useWorldStore();
|
||||
const { showFullscreenImageDialog } = useGalleryStore();
|
||||
|
||||
@@ -321,6 +321,9 @@
|
||||
}
|
||||
ref = data[i];
|
||||
if (D.worldImportFavoriteGroup) {
|
||||
if (getCachedFavoritesByObjectId(ref.id)) {
|
||||
throw new Error('World is already in favorites');
|
||||
}
|
||||
await addFavoriteWorld(ref, D.worldImportFavoriteGroup, false);
|
||||
} else if (D.worldImportLocalFavoriteGroup) {
|
||||
addLocalWorldFavorite(ref.id, D.worldImportLocalFavoriteGroup);
|
||||
|
||||
Reference in New Issue
Block a user