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
+1 -1
View File
@@ -62,7 +62,7 @@ const favoriteReq = {
json, json,
params params
}; };
useFavoriteStore().handleFavoriteDelete(args); useFavoriteStore().handleFavoriteDelete(params.objectId);
return args; return args;
}); });
}, },
+2 -3
View File
@@ -307,12 +307,11 @@ export const useFavoriteStore = defineStore('Favorite', () => {
} }
} }
function handleFavoriteDelete(args) { function handleFavoriteDelete(objectId) {
const ref = getCachedFavoritesByObjectId(args.params.objectId); const ref = getCachedFavoritesByObjectId(objectId);
if (typeof ref === 'undefined') { if (typeof ref === 'undefined') {
return; return;
} }
args.ref = ref;
handleFavoriteAtDelete(ref); handleFavoriteAtDelete(ref);
} }
+2
View File
@@ -49,6 +49,7 @@ export const useFriendStore = defineStore('Friend', () => {
const updateLoopStore = useUpdateLoopStore(); const updateLoopStore = useUpdateLoopStore();
const authStore = useAuthStore(); const authStore = useAuthStore();
const locationStore = useLocationStore(); const locationStore = useLocationStore();
const favoriteStore = useFavoriteStore();
const { t } = useI18n(); const { t } = useI18n();
const state = reactive({ const state = reactive({
@@ -1049,6 +1050,7 @@ export const useFriendStore = defineStore('Friend', () => {
notificationStore.queueFriendLogNoty(friendLogHistory); notificationStore.queueFriendLogNoty(friendLogHistory);
friendLog.delete(id); friendLog.delete(id);
database.deleteFriendLogCurrent(id); database.deleteFriendLogCurrent(id);
favoriteStore.handleFavoriteDelete(id);
if (!appearanceSettingsStore.hideUnfriends) { if (!appearanceSettingsStore.hideUnfriends) {
uiStore.notifyMenu('friend-log'); uiStore.notifyMenu('friend-log');
} }