mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-28 19:23:47 +02:00
fix local friend favorites
This commit is contained in:
@@ -1536,6 +1536,15 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
if (hasLocalFriendFavorite(userId, group)) {
|
||||
return;
|
||||
}
|
||||
for (const existingGroup in localFriendFavorites) {
|
||||
const members = localFriendFavorites[existingGroup];
|
||||
const idx = members?.indexOf(userId);
|
||||
if (idx !== undefined && idx !== -1) {
|
||||
members.splice(idx, 1);
|
||||
database.removeFriendFromLocalFavorites(userId, existingGroup);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!localFriendFavorites[group]) {
|
||||
localFriendFavorites[group] = [];
|
||||
}
|
||||
@@ -1547,6 +1556,10 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
) {
|
||||
updateFavoriteDialog(userId);
|
||||
}
|
||||
const userDialog = userStore.userDialog;
|
||||
if (userDialog.visible && userDialog.id === userId) {
|
||||
userDialog.isFavorite = true;
|
||||
}
|
||||
if (
|
||||
generalSettingsStore.localFavoriteFriendsGroups.includes(
|
||||
`local:${group}`
|
||||
@@ -1569,6 +1582,20 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
return favoriteGroup.includes(userId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a user is in any local friend favorite group.
|
||||
* @param {string} userId
|
||||
* @returns {boolean}
|
||||
*/
|
||||
function isInAnyLocalFriendGroup(userId) {
|
||||
for (const group in localFriendFavorites) {
|
||||
if (localFriendFavorites[group]?.includes(userId)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} userId
|
||||
* @param {string} group
|
||||
@@ -1588,6 +1615,12 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
) {
|
||||
updateFavoriteDialog(userId);
|
||||
}
|
||||
const userDialog = userStore.userDialog;
|
||||
if (userDialog.visible && userDialog.id === userId) {
|
||||
userDialog.isFavorite =
|
||||
getCachedFavoritesByObjectId(userId) ||
|
||||
isInAnyLocalFriendGroup(userId);
|
||||
}
|
||||
if (
|
||||
generalSettingsStore.localFavoriteFriendsGroups.includes(
|
||||
`local:${group}`
|
||||
@@ -1806,6 +1839,7 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
getCachedFavoriteGroupsByTypeName,
|
||||
addLocalFriendFavorite,
|
||||
hasLocalFriendFavorite,
|
||||
isInAnyLocalFriendGroup,
|
||||
removeLocalFriendFavorite,
|
||||
deleteLocalFriendFavoriteGroup,
|
||||
renameLocalFriendFavoriteGroup,
|
||||
|
||||
Reference in New Issue
Block a user