Skip to content

feat(events): add website field to the Details tab - #590

Merged
Ardnived merged 15 commits into
mainfrom
feat/event-website-field
Jul 19, 2026
Merged

Ardnived merged 15 commits into
mainfrom
feat/event-website-field

Conversation

@Ardnived

@Ardnived Ardnived commented Jul 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Adds an optional website link to the Events Details tab, for pointing seekers at a center page, Facebook event, or flyer.
  • Distinct from onlineUrl (where attendees join) and externalRegistrationUrl (where they sign up) — neither was a general "learn more" link.
  • Backfills it for 14 events in the atlas seed data, lifting URLs managers had buried in free-text descriptions.
  • Along the way, removes two long-standing local-dev papercuts the seeding work exposed (see Incidental fixes).

Changes

The feature (#584)

  • src/collections/Events/Events.ts — website via the shared urlField() factory, after description. Not localized, not required: one URL across all 19 locales, matching the collection's other URL fields.
  • seeds/atlas/data/events.json + seeds/atlas/import.ts — 14 curated values, mapped into the collection.
  • tests/unit/url-field.spec.ts — first coverage for the urlField() validator; also back-fills onlineUrl / externalRegistrationUrl.
  • tests/int/events.int.spec.ts — new general Events spec (the collection had none).

Incidental fixes

  • seeds/run.ts, seeds/env.ts — pnpm seed no longer needs credentials against localhost. Local dev enables Payload's admin.autoLogin, which Payload applies in its JWT auth strategy — a request carrying no token is authenticated as that admin. The CLI never benefited, because it opened with an explicit POST /api/managers/login that validates the password for real, so a stale or blank value 401'd before any work started. It now probes /api/managers/me and skips login when the target auto-logs-in. seeds/env.ts also rejected a deliberately blank ADMIN_PASSWORD (a bare .optional() still runs min(8) on ""), so emptying the value you no longer need threw at module load; empty now reads as unset.
  • .prettierignore (new) — prettier was reformatting src/migrations/index.ts, which payload migrate:create owns. That made the committed file diverge from the generator, so the next migration re-emitted all ~30 import lines. Restored the generator's formatting and ignored the file, plus the other generated files ESLint already ignores. This is why index.ts shows a 34/28-line diff — a one-time cost so future migrations are a one-entry diff.

How the 14 were chosen

34 event descriptions contain a URL, but 21 were deliberately excluded: they merely repeat onlineUrl (Zoom / Meet / Mixlr join links) or registrationUrl (Google Forms), and one is a Google Maps pin. Copying those in would have duplicated existing fields. Own domains beat aggregators, then the event's languageCode breaks ties (event 376 is DE, so de.inthemoment.today won over the en. variant). One URL was stored bare (www.meetup.com/…) and needed an https:// prefix to pass validation. Full rationale in seeds/atlas/AGENTS.md.

Migration

  • New migration: src/migrations/20260718_230825_add_event_website.ts
  • Impact: adds a nullable website column to events and version_website to _events_v (drafts are enabled). No existing data touched.
  • Reversible: yes — down() drops both columns; nothing to preserve since the column is new.

Test Results

  • Lint: ✓ · Typecheck: ✓ · Unit: ✓ 693 passed (68 files) · Integration (targeted events.int.spec.ts): ✓ 2 passed
  • Seed against a local DB in update mode: ✓ 507 events updated, all 14 website values persisted, no website-related errors or warnings
  • Seed CLI, both auth paths: ✓ runs against localhost with a blank password; an unreachable target still demands credentials
  • Full suite + smoke: CI

Notes for reviewer

  1. The non-localization test is mutation-verified — setting localized: true makes the Czech read return undefined and the test fail, so it guards the contract rather than passing vacuously.
  2. The auto-login probe double-checks itself. A truthy user alone isn't proof the target auto-logs-in: an edge cache can replay a previously authenticated response to a tokenless probe. Since this repo has already been bitten by exactly that (a Cloudflare rule serving cached authed content to requests with no Authorization header), the probe confirms with a second request carrying DisableAutologin: true — a live Payload always answers that with { user: null }. Anything else means we're reading a cached body, and we fall back to credentials.
  3. extract.ts cannot reproduce the curated website values (Atlas has no such column), so re-running it drops them. Guarded by comments in extract.ts, AGENTS.md, and MIGRATION_PLAN.md. An enforcing check was suggested but left out: extract.ts needs the Atlas PG dump to run, so it couldn't be verified end-to-end here.
  4. website is deliberately not surfaced in verification emails, and two of the 14 (t.me, chat.whatsapp.com) are chat channels rather than web pages — intentional, but worth a look if the Atlas widget labels this "Visit website".

A review pass also flagged a pre-existing type-safety gap in the shared factory: UrlFieldOptions doesn't Omit validate, so a caller passing their own validator has it silently overridden. Left alone — untouched by this branch, and changing it ripples to every urlField() caller.

Closes #584

🤖 Generated with Claude Code

Ardnived and others added 7 commits July 18, 2026 16:08
Optional, non-localized URL for a page with more information about the
class — distinct from `onlineUrl` (where attendees join) and
`externalRegistrationUrl` (where they sign up). Uses the shared
urlField() factory for http/https protocol validation.

Refs #584

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Adds nullable "website" to events and "version_website" to _events_v
(drafts are enabled on this collection).

Refs #584

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Two non-overlapping lanes:

- tests/unit/url-field.spec.ts asserts the shared urlField() validator's
  own behaviour (protocol + format messages, blank passes). The factory
  had no coverage, so this also back-fills onlineUrl and
  externalRegistrationUrl.
- tests/int/events.int.spec.ts proves the validator is wired onto
  Events.website, and that the value is not localized — verified by
  mutation (marking the field `localized: true` makes the Czech read
  return undefined and the test fail).

Refs #584

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
payload migrate:create rewrites src/migrations/index.ts with semicolons,
reformatting all 27 existing imports. Re-running prettier reduces the
diff to the one added migration entry.

Refs #584

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Per /simplify: the double cast and `{} as Parameters<...>[1]` argument
were unnecessary scaffolding — the validator is callable directly.

Refs #584

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Per /code-review: matching Payload's "Details > Website" admin label is
brittle. Assert `data.errors[].path === 'website'` and the validator's
real message instead, matching the pattern in lectures.int.spec.ts.

Refs #584

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Events had no row despite four existing int specs; adding the first
general events spec made the omission conspicuous.

Refs #584

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-590 July 18, 2026 23:31 Destroyed
@railway-app

railway-app Bot commented Jul 18, 2026 •

Copy link
Copy Markdown

🚅 Deployed to the SahajCloud-pr-590 environment in sahajcloud

Service Status Web Updated (UTC)
SahajCloud ✅ Success (View Logs) Web Jul 19, 2026 at 2:00 pm

Ardnived and others added 3 commits July 18, 2026 17:40
Lifts the "learn more" URLs managers had buried in free-text event
descriptions into the new `website` field — 14 events.

URLs already carried by another field were deliberately skipped: 21 of
the 34 descriptions containing a link just repeat `onlineUrl` (Zoom /
Meet / Mixlr join links) or `registrationUrl` (Google Forms), and
`website` is the "more information" link, not where you join or sign up.
Map links were skipped too. Own domains beat aggregators, then the
event's languageCode breaks ties.

extract.ts cannot reproduce these (Atlas has no such column), so both it
and seeds/atlas/AGENTS.md now warn that a re-extraction drops them.

Verified: seeded the local DB in update mode — 507 events updated, all
14 website values persisted, no website-related errors or warnings.

Refs #584

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Per /simplify: the curated values are never null (14 keys, all non-empty
strings), so `website?: string` matches the real contract — sibling
fields are `string | null` because those are nullable Atlas columns.
Trims the interface comment to point at AGENTS.md instead of restating it.

Refs #584

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The events.json section enumerates every field in the file; `website` is
the one that doesn't come from Atlas.

Refs #584

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-590 July 19, 2026 12:42 Destroyed
Ardnived and others added 5 commits July 19, 2026 05:56
src/migrations/index.ts is written by `payload migrate:create` in its own
style (semicolons). Prettier reformatting it made the file diverge from
the generator, so the next migration re-emitted all ~30 import lines and
buried the real change — exactly what happened in this branch's earlier
"restore repo formatting" commit.

Adds .prettierignore (the repo had none) covering src/migrations/, which
ESLint already ignores for the same reason, and restores the file to the
generator's output so future migrations produce a one-entry diff.

Refs #584

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Local dev sets `admin.autoLogin`, which Payload applies in its JWT
strategy — a request carrying no token is authenticated as that admin.
The CLI never benefited, because it opened with an explicit
POST /api/managers/login that validates the password for real, so a
stale or blank value 401'd before any work started.

The CLI now probes /api/managers/me first and, when the target
auto-logs-in, skips the login and sends its requests without an
Authorization header. It probes the capability rather than matching on
"localhost" because that's what actually decides the outcome: production
and E2E disable auto-login and fall through to the credential path on
their own.

seeds/env.ts also rejected a deliberately blank ADMIN_PASSWORD — a bare
.optional() still runs min(8) against the empty string — so blanking the
value you no longer need threw at module load. Empty now reads as unset.

Verified both paths: `pnpm seed atlas --dry-run` runs against localhost
with no credentials, and an unreachable target still demands them.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
fetchScriptMetadata still built `Authorization: JWT ${token}` directly,
so the auto-login path sent the literal header `JWT null`. It happened to
work — Payload's JWT strategy falls back to auto-login when jwtVerify
throws — which is exactly why the end-to-end run didn't catch it. Verified
the header is inert: with `DisableAutologin: true` that same request 401s.

Also extends .prettierignore to src/payload-types.ts and importMap.js.
Both are committed in their generator's format (`prettier --check` flags
both as "would rewrite"), so formatting either invites the same whole-file
churn the migration index just had.

Refs #584

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
seeds/AGENTS.md listed ADMIN_EMAIL/ADMIN_PASSWORD under "Required
environment variables" and shipped a sample .env.local with a filled-in
password — both stale now that the CLI skips login when the target
auto-logs-in.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
A truthy `user` from /api/managers/me isn't proof the target auto-logs-in:
an edge cache in front of a remote target can replay a previously
*authenticated* response to our tokenless probe, which looks identical.
This repo has already been bitten by that class of bug — a Cloudflare
cache rule keyed on Vary:Authorization still serves cached authed content
to a request that sends no Authorization header at all.

Confirms with a second probe carrying `DisableAutologin: true`, which a
live Payload always answers with `{ user: null }`. A user there means we
are reading a cached body, so we fall back to the credential path.

Verified locally: tokenless → user present, DisableAutologin → user null,
and `pnpm seed atlas --dry-run` still runs with no credentials.

Refs #584

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-590 July 19, 2026 13:57 Destroyed
@Ardnived
Ardnived merged commit a29b94e into main Jul 19, 2026
2 checks passed
@Ardnived
Ardnived deleted the feat/event-website-field branch July 19, 2026 15:43
Ardnived added a commit that referenced this pull request Jul 19, 2026
Resolves the migration chain against #590 (events.website). My migration was
regenerated under a new timestamp (20260719_213905, was 20260718_231450) so its
snapshot base is #590's — healing the out-of-order snapshot trap. The
regeneration also surfaced and fixed a real gap: the `emails` translations
column (sy_atlas_translations_locales.emails + its _v companion) was created by
no migration, because the original was generated before the emails group was
added. Dev/tests use push:true so it went unnoticed; prod applies migrations
only, so the Emails admin tab would have failed to save in production.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

This branch was successfully deployed

No deployments
sahajcloud / SahajCloud-pr-590 — 4949c393 Deployed Jul 19, 2026 by railway-app[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(events): add website field to the Details tab

1 participant