Skip to content

Commit 116f745

Browse files
authored
Fix meetup duplication (#2342)
1 parent 05ac3e8 commit 116f745

File tree

7 files changed

+73
-139
lines changed

7 files changed

+73
-139
lines changed

scripts/sync-working-groups/sync-working-groups.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const CALENDAR_ID =
88
const API_KEY = process.env.GOOGLE_CALENDAR_API_KEY
99
const OUTPUT_FILE = new URL("./working-group-events.ndjson", import.meta.url)
1010
const DAYS_BACK = 36
11-
const DAYS_TO_KEEP = 90
11+
const DAYS_TO_KEEP = 5 * 365
1212
const DAYS_AHEAD = 500
1313

1414
const Instant = type({

scripts/sync-working-groups/working-group-events.ndjson

Lines changed: 65 additions & 33 deletions
Large diffs are not rendered by default.

src/app/(main)/community/events/events-list.tsx

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import type { WorkingGroupMeeting as CalendarEvent } from "@/../scripts/sync-wor
77

88
import { EventCard } from "./event-card"
99
import { EventsScrollview } from "./events-scrollview"
10-
import type { Event, Meetup } from "./events"
10+
import type { Event } from "./events"
1111
import { EventFilterTag, EventKind } from "./event-filter-tag"
1212

1313
interface FilterChipProps extends ComponentPropsWithoutRef<"button"> {
@@ -55,7 +55,7 @@ export function FilterChip({
5555
)
5656
}
5757

58-
type AnyEvent = Event | Meetup | CalendarEvent
58+
type AnyEvent = Event | CalendarEvent
5959

6060
// NOTE: the order of this controls the order of the tag toggles
6161
const DEFAULT_VISIBILITY = {
@@ -79,9 +79,7 @@ function isSoon(date: Date) {
7979
}
8080

8181
function categorizeEvent(event: AnyEvent): EventKind | "duplicate" | null {
82-
if ("node" in event) {
83-
return "meetup"
84-
} else if ("start" in event) {
82+
if ("start" in event) {
8583
// From https://calendar.graphql.org
8684
const summary = event.summary ?? ""
8785
if (/\b(Subcommittee|Committee)\b/i.test(summary)) {
@@ -249,16 +247,7 @@ export function EventsList({
249247
if (kind === "duplicate" || kind == null) {
250248
return null
251249
}
252-
return "node" in event ? (
253-
<EventCard
254-
key={event.node.id}
255-
name={event.node.name}
256-
href={event.node.link}
257-
city={event.node.city + ", " + event.node.country}
258-
date={event.node.next || event.node.prev}
259-
kind={kind}
260-
/>
261-
) : "start" in event ? (
250+
return "start" in event ? (
262251
// It's from the calendar
263252
<EventCard
264253
key={event.id}

src/app/(main)/community/events/events.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,3 @@ export const events: Event[] = [
166166
hostLink: "https://www.truedigitalpark.com/",
167167
},
168168
].sort((a, b) => new Date(b.date).getTime() - new Date(a.date).getTime())
169-
170-
import type { meetups } from "@/components/meetups"
171-
172-
export type Meetup = (typeof meetups)[number]

src/app/(main)/community/events/get-all-events.ts

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@ import { join } from "node:path"
22
import { readFile } from "node:fs/promises"
33
import { cache } from "react"
44

5-
import { meetups } from "@/components/meetups"
6-
75
import type { WorkingGroupMeeting } from "@/../scripts/sync-working-groups/sync-working-groups"
86

9-
import { events, type Event, type Meetup } from "./events"
7+
import { events, type Event } from "./events"
108

11-
type AnyEvent = Event | Meetup | WorkingGroupMeeting
9+
type AnyEvent = Event | WorkingGroupMeeting
1210

1311
const WORKING_GROUP_MEETINGS_FILE = join(
1412
process.cwd(),
@@ -38,33 +36,8 @@ export const getAllEvents = cache(async () => {
3836
} else upcomingEvents.push(meeting)
3937
}
4038

41-
for (const meetup of meetups) {
42-
const { next, prev } = meetup.node
43-
44-
// if next is in the past we treat it as past event
45-
if (next && new Date(next) < now) {
46-
pastEvents.push(meetup)
47-
}
48-
// if prev is in the past it is obviously a past event
49-
else if (prev && new Date(prev) < now) {
50-
pastEvents.push({
51-
node: {
52-
...meetup.node,
53-
// we disregard .next, it's checked in nexdt if statement
54-
next: "",
55-
},
56-
})
57-
}
58-
59-
// if next is in the future, it is an upcoming event
60-
if (next && new Date(next) >= now) {
61-
upcomingEvents.push(meetup)
62-
}
63-
}
64-
6539
const getDate = (event: AnyEvent) => {
6640
if ("date" in event) return new Date(event.date)
67-
if ("node" in event) return new Date(event.node.next || event.node.prev)
6841
return new Date(event.start)
6942
}
7043

src/app/(main)/community/events/rss.xml/route.tsx

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,7 @@ export async function GET() {
1818
})
1919

2020
for (const event of allEvents) {
21-
if ("node" in event) {
22-
let date: Date
23-
if (event.node.next && new Date(event.node.next) > new Date()) {
24-
date = new Date(event.node.next)
25-
} else {
26-
date = new Date(event.node.prev)
27-
}
28-
29-
feed.item({
30-
title: event.node.name,
31-
date,
32-
url: event.node.link,
33-
description: "",
34-
lat: event.node.latitude,
35-
long: event.node.longitude,
36-
})
37-
} else if ("start" in event) {
21+
if ("start" in event) {
3822
feed.item({
3923
title: event.summary || "GraphQL Working Group",
4024
date: event.start,

src/components/meetups.ts

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ export const meetups = [
1010
state: "",
1111
country: "Netherlands",
1212
link: "https://www.meetup.com/amsterdam-graphql-meetup",
13-
prev: "2025-09-07",
14-
next: "",
1513
official: true,
1614
},
1715
},
@@ -25,8 +23,6 @@ export const meetups = [
2523
state: "",
2624
country: "Israel",
2725
link: "https://www.meetup.com/graphql-tlv",
28-
prev: "",
29-
next: "",
3026
official: false,
3127
},
3228
},
@@ -40,8 +36,6 @@ export const meetups = [
4036
state: "TX",
4137
country: "USA",
4238
link: "https://www.meetup.com/atx-graphql",
43-
prev: "2025-08-24",
44-
next: "",
4539
official: true,
4640
},
4741
},
@@ -55,8 +49,6 @@ export const meetups = [
5549
state: "",
5650
country: "Germany",
5751
link: "https://www.meetup.com/graphql-hamburg/",
58-
prev: "",
59-
next: "",
6052
official: false,
6153
},
6254
},
@@ -70,8 +62,6 @@ export const meetups = [
7062
state: "WA",
7163
country: "USA",
7264
link: "https://www.meetup.com/graphql-seattle",
73-
prev: "",
74-
next: "",
7565
official: false,
7666
},
7767
},
@@ -85,8 +75,6 @@ export const meetups = [
8575
state: "CA",
8676
country: "USA",
8777
link: "http://meetup.com/GraphQL-SF",
88-
prev: "",
89-
next: "",
9078
official: false,
9179
},
9280
},
@@ -100,8 +88,6 @@ export const meetups = [
10088
state: "",
10189
country: "Switzerland",
10290
link: "https://www.meetup.com/graphql-zurich",
103-
prev: "",
104-
next: "",
10591
official: false,
10692
},
10793
},
@@ -115,8 +101,6 @@ export const meetups = [
115101
state: "",
116102
country: "Denmark",
117103
link: "https://www.meetup.com/copenhagen-graphql-meetup-group",
118-
prev: "",
119-
next: "",
120104
official: false,
121105
},
122106
},
@@ -130,8 +114,6 @@ export const meetups = [
130114
state: "",
131115
country: "Germany",
132116
link: "https://www.meetup.com/graphql-berlin/",
133-
prev: "2025-09-11",
134-
next: "",
135117
official: false,
136118
},
137119
},
@@ -145,8 +127,6 @@ export const meetups = [
145127
state: "",
146128
country: "Thailand",
147129
link: "https://www.meetup.com/graphql-bangkok",
148-
prev: "",
149-
next: "",
150130
official: false,
151131
},
152132
},
@@ -160,8 +140,6 @@ export const meetups = [
160140
state: "",
161141
country: "Poland",
162142
link: "https://guild.host/graphql-bialystok/",
163-
prev: "",
164-
next: "",
165143
official: true,
166144
},
167145
},
@@ -175,8 +153,6 @@ export const meetups = [
175153
state: "",
176154
country: "India",
177155
link: "https://guild.host/graphql-hyderabad/",
178-
prev: "2025-08-09",
179-
next: "",
180156
official: true,
181157
},
182158
},
@@ -190,8 +166,6 @@ export const meetups = [
190166
state: "",
191167
country: "UK",
192168
link: "https://guild.host/london-graphql",
193-
prev: "2025-07-01",
194-
next: "October 2025",
195169
official: true,
196170
},
197171
},
@@ -205,8 +179,6 @@ export const meetups = [
205179
state: "",
206180
country: "Kenya",
207181
link: "https://www.meetup.com/nairobi-graphql-meetup/",
208-
prev: "",
209-
next: "",
210182
official: false,
211183
},
212184
},
@@ -220,8 +192,6 @@ export const meetups = [
220192
state: "NY",
221193
country: "USA",
222194
link: "https://guild.host/graphql-new-york/events",
223-
prev: "",
224-
next: "",
225195
official: false,
226196
},
227197
},
@@ -235,8 +205,6 @@ export const meetups = [
235205
state: "",
236206
country: "Norway",
237207
link: "https://guild.host/graphql-oslo/",
238-
prev: "2025-10-27",
239-
next: "2026-01-26",
240208
official: true,
241209
},
242210
},
@@ -250,8 +218,6 @@ export const meetups = [
250218
state: "",
251219
country: "France",
252220
link: "https://www.meetup.com/fr-FR/parisgraphql/",
253-
prev: "",
254-
next: "2025-10-22",
255221
official: true,
256222
},
257223
},
@@ -265,8 +231,6 @@ export const meetups = [
265231
state: "PA",
266232
country: "USA",
267233
link: "https://luma.com/phillygraphql",
268-
prev: "",
269-
next: "2026-01-22",
270234
official: true,
271235
},
272236
},
@@ -280,8 +244,6 @@ export const meetups = [
280244
state: "",
281245
country: "Australia",
282246
link: "https://luma.com/graphql-sydney",
283-
prev: "2024-11-12",
284-
next: "",
285247
official: false,
286248
},
287249
},
@@ -295,8 +257,6 @@ export const meetups = [
295257
state: "",
296258
country: "Taiwan",
297259
link: "https://guild.host/graphql-taipei/events",
298-
prev: "",
299-
next: "",
300260
official: false,
301261
},
302262
},

0 commit comments

Comments
 (0)