refactor auto change status

This commit is contained in:
pa
2026-02-14 17:07:22 +09:00
parent 64869a218e
commit 4e552bf3b9
5 changed files with 310 additions and 77 deletions

View File

@@ -247,10 +247,40 @@ export const useNotificationStore = defineStore('Notification', () => {
}
if (
generalSettingsStore.autoAcceptInviteRequests ===
'Selected Favorites' &&
!friendStore.localFavoriteFriends.has(ref.senderUserId)
'Selected Favorites'
) {
return;
const groups = generalSettingsStore.autoAcceptInviteGroups;
if (groups.length === 0) {
return;
} else {
let found = false;
for (const groupKey of groups) {
if (groupKey.startsWith('local:')) {
const localGroup = groupKey.slice(6);
const localFavs =
favoriteStore.localFriendFavorites.get(localGroup);
if (localFavs && localFavs.has(ref.senderUserId)) {
found = true;
break;
}
} else {
const remoteFavs =
favoriteStore.cachedFavorites.get(groupKey);
if (
remoteFavs &&
remoteFavs.some(
(f) => f.favoriteId === ref.senderUserId
)
) {
found = true;
break;
}
}
}
if (!found) {
return;
}
}
}
if (!checkCanInvite(currentLocation)) {
return;