Skip to content

Commit e8472b4

Browse files
committed
web: Fix issue code details not fetched for subscription additions in recent events panel
1 parent ca0a8ac commit e8472b4

File tree

1 file changed

+21
-10
lines changed

1 file changed

+21
-10
lines changed

apps/web/src/components/RecentEvents.vue

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
<script setup lang="ts">
2020
import type { AbstractEvent } from "~dm-types/events/AbstractEvent";
21+
import type { CollectionSubscriptionAdditionEvent } from "~dm-types/events/CollectionSubscriptionAdditionEvent";
2122
import type { CollectionUpdateEvent } from "~dm-types/events/CollectionUpdateEvent";
2223
import type { EdgeCreationEvent } from "~dm-types/events/EdgeCreationEvent";
2324
@@ -37,23 +38,33 @@ const eventUserIds = $computed(() =>
3738
);
3839
const isCollectionUpdateEvent = (
3940
event: AbstractEvent,
40-
): event is CollectionUpdateEvent => event.hasOwnProperty("numberOfIssues");
41+
): event is CollectionUpdateEvent => event.type === "collection_update";
4142
4243
const isEdgeCreationEvent = (
4344
event: AbstractEvent,
44-
): event is EdgeCreationEvent => event.hasOwnProperty("issuecodes");
45+
): event is EdgeCreationEvent => event.type === "edge";
46+
47+
const isCollectionSubscriptionAdditionEvent = (
48+
event: AbstractEvent,
49+
): event is CollectionSubscriptionAdditionEvent =>
50+
event.type === "subscription_additions";
4551
4652
const fetchEventsAndAssociatedData = async () => {
4753
await fetchEvents();
4854
49-
await fetchIssuecodeDetails([
50-
...events.value
51-
.filter((event) => isCollectionUpdateEvent(event))
52-
.map(({ exampleIssuecode }) => exampleIssuecode),
53-
...events.value
54-
.filter((event) => isEdgeCreationEvent(event))
55-
.reduce<string[]>((acc, { issuecodes }) => [...acc, ...issuecodes], []),
56-
]);
55+
await fetchIssuecodeDetails(
56+
[
57+
events.value
58+
.filter((event) => isCollectionUpdateEvent(event))
59+
.map(({ exampleIssuecode }) => exampleIssuecode),
60+
events.value
61+
.filter((event) => isCollectionSubscriptionAdditionEvent(event))
62+
.reduce<string[]>((acc, { issuecode }) => [...acc, issuecode], []),
63+
events.value
64+
.filter((event) => isEdgeCreationEvent(event))
65+
.reduce<string[]>((acc, { issuecodes }) => [...acc, ...issuecodes], []),
66+
].flat(),
67+
);
5768
5869
await fetchPublicationNames([
5970
...events.value

0 commit comments

Comments
 (0)