mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-23 00:33:50 +02:00
Mark as seen (queued to avoid 429 rate-limiting)
This commit is contained in:
@@ -249,7 +249,6 @@
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { Separator } from '@/components/ui/separator';
|
||||
import { TooltipWrapper } from '@/components/ui/tooltip';
|
||||
import { notificationRequest } from '@/api';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
@@ -273,7 +272,7 @@
|
||||
const notificationStore = useNotificationStore();
|
||||
const { lastLocation } = storeToRefs(useLocationStore());
|
||||
const { isGameRunning } = storeToRefs(useGameStore());
|
||||
const { openNotificationLink, isNotificationExpired, handleNotificationV2Hide } = useNotificationStore();
|
||||
const { openNotificationLink, isNotificationExpired } = useNotificationStore();
|
||||
|
||||
const senderName = computed(() => {
|
||||
const n = props.notification;
|
||||
@@ -479,34 +478,11 @@
|
||||
}
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
// Mark as seen
|
||||
// Mark as seen (queued to avoid 429 rate-limiting)
|
||||
if (isNotificationExpired(props.notification) || isSeen.value) {
|
||||
return;
|
||||
}
|
||||
const params = { notificationId: props.notification.id };
|
||||
if (!props.notification.version || props.notification.version < 2) {
|
||||
notificationRequest.seeNotification({ notificationId: props.notification.id }).then((args) => {
|
||||
console.log('Marked notification-v1 as seen:', args.json);
|
||||
notificationStore.handleNotificationSee(props.notification.id);
|
||||
});
|
||||
return;
|
||||
}
|
||||
notificationRequest
|
||||
.seeNotificationV2(params)
|
||||
.then((args) => {
|
||||
console.log('Marked notification-v2 as seen:', args.json);
|
||||
const newArgs = {
|
||||
params,
|
||||
json: {
|
||||
...args.json,
|
||||
seen: true
|
||||
}
|
||||
};
|
||||
notificationStore.handleNotificationV2Update(newArgs);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error('Failed to mark notification-v2 as seen:', err);
|
||||
handleNotificationV2Hide(props.notification.id);
|
||||
});
|
||||
const version = props.notification.version || 1;
|
||||
notificationStore.queueMarkAsSeen(props.notification.id, version);
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user