Remove favorite when unfriending

This commit is contained in:
Natsumi
2025-12-03 15:54:44 +13:00
parent e76d39b72b
commit 25296e21b1
3 changed files with 5 additions and 4 deletions

View File

@@ -62,7 +62,7 @@ const favoriteReq = {
json,
params
};
useFavoriteStore().handleFavoriteDelete(args);
useFavoriteStore().handleFavoriteDelete(params.objectId);
return args;
});
},

View File

@@ -307,12 +307,11 @@ export const useFavoriteStore = defineStore('Favorite', () => {
}
}
function handleFavoriteDelete(args) {
const ref = getCachedFavoritesByObjectId(args.params.objectId);
function handleFavoriteDelete(objectId) {
const ref = getCachedFavoritesByObjectId(objectId);
if (typeof ref === 'undefined') {
return;
}
args.ref = ref;
handleFavoriteAtDelete(ref);
}

View File

@@ -49,6 +49,7 @@ export const useFriendStore = defineStore('Friend', () => {
const updateLoopStore = useUpdateLoopStore();
const authStore = useAuthStore();
const locationStore = useLocationStore();
const favoriteStore = useFavoriteStore();
const { t } = useI18n();
const state = reactive({
@@ -1049,6 +1050,7 @@ export const useFriendStore = defineStore('Friend', () => {
notificationStore.queueFriendLogNoty(friendLogHistory);
friendLog.delete(id);
database.deleteFriendLogCurrent(id);
favoriteStore.handleFavoriteDelete(id);
if (!appearanceSettingsStore.hideUnfriends) {
uiStore.notifyMenu('friend-log');
}