remove unecessary notification in frontend

This commit is contained in:
Tim Gröger 2023-05-01 22:46:16 +02:00
parent c721f25104
commit ae275aeabb
1 changed files with 16 additions and 0 deletions

View File

@ -59,6 +59,7 @@ import { computed, defineComponent, ref, onBeforeMount, watch } from 'vue';
import { QTableProps } from 'quasar';
import { Job } from '../store/models';
import { useEventStore } from '../store';
import { EventNotification, InvitationData, InvitationResponseData } from '../events';
export default defineComponent({
name: 'PageEventRequests',
@ -92,6 +93,9 @@ export default defineComponent({
? store.invitations
: store.invitations.filter((i) => i.inviter_id !== mainStore.currentUser.userid)
);
const all_notifications = computed<EventNotification[]>(() => {
return mainStore.notifications.filter((n) => n.plugin === 'events') as EventNotification[];
});
const showSent = ref(false);
async function fillRows(data: FG.Invitation[]) {
@ -247,6 +251,12 @@ export default defineComponent({
filter: () => [],
getCellValue: () => [],
});
const notification = all_notifications.value.find(
(n) => n.data.invitation === row.id
);
if (notification !== undefined) {
void mainStore.removeNotification(notification.id);
}
},
};
const accept = {
@ -260,6 +270,12 @@ export default defineComponent({
filter: () => [],
getCellValue: () => [],
});
const notification = all_notifications.value.find(
(n) => n.data.invitation === row.id
);
if (notification !== undefined) {
void mainStore.removeNotification(notification.id);
}
},
};
if (sender) {