Skip to content

Commit 93260c4

Browse files
committed
Address AI comments with AI
1 parent dcb05ed commit 93260c4

2 files changed

Lines changed: 17 additions & 11 deletions

File tree

backend/clubs/sitemap.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,17 +61,24 @@ def get(self, request):
6161
for code in visible_clubs.values_list("code", flat=True):
6262
paths.append(f"/club/{code}/")
6363

64-
# Query events from visible clubs (or global events with club=null)
65-
# Same visibility logic as EventViewSet for public viewers
64+
# Query events matching EventViewSet.get_queryset() for public viewers
65+
# FAIR events can come from clubs not in visible_clubs, so we can't
66+
# restrict to club__in=visible_clubs first
6667
events = (
6768
Event.objects.filter(
68-
Q(club__in=visible_clubs) | Q(club__isnull=True),
69+
# Must not be archived
70+
Q(club__isnull=True) | Q(club__archived=False),
6971
)
7072
.filter(
71-
Q(club__isnull=True)
72-
| Q(club__approved=True)
73+
# Approval/type filter (same as EventViewSet lines 3218-3223)
74+
Q(club__approved=True)
7375
| Q(type=Event.FAIR)
7476
| Q(club__ghost=True)
77+
| Q(club__isnull=True),
78+
)
79+
.filter(
80+
# Public viewer filter (same as EventViewSet line 3228)
81+
Q(club__isnull=True) | Q(club__visible_to_public=True),
7582
)
7683
.values_list("id", flat=True)
7784
)

frontend/next-sitemap.config.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,7 @@ module.exports = {
2525
// Fetch dynamic club and event URLs from backend
2626
additionalPaths: async (config) => {
2727
try {
28-
const apiUrl = process.env.DOMAIN
29-
? process.env.DOMAIN.startsWith('http')
30-
? process.env.DOMAIN
31-
: `https://${process.env.DOMAIN}`
32-
: 'https://pennclubs.com'
33-
const res = await fetch(`${apiUrl}/api/sitemap-paths/`)
28+
const res = await fetch(`${config.siteUrl}/api/sitemap-paths/`)
3429
if (!res.ok) {
3530
return []
3631
}
@@ -56,6 +51,10 @@ module.exports = {
5651
'/create',
5752
'/renew',
5853
'/invite/',
54+
'/applications',
55+
'/user/',
56+
'/wharton/',
57+
'/health',
5958
],
6059
},
6160
],

0 commit comments

Comments
 (0)