Repository navigation
feat: optional website, phone and hours for places - #364
Merged
Merged
Conversation
Three optional fields so a library or government office can say how to reach it and when it is open. The schema, the validator (format only: an https URL, E.164 phone, short single-line hours) and the Place type agree, no existing record needs them, and /api/places returns them unchanged. data/CONTRIBUTING.md documents them and adds the rule that phone and hours must come from the place's own site or listing, with the date checked in the PR.
…rawer Empty fields are hidden and a place with none renders exactly as before. The website links only when it is a well-formed https URL, and the phone becomes a tel: link only when it is in international form.
…e form The form, the server route, the issue body and the pull-request record all carry the three optional fields. A blank field is left out; a malformed one is rejected with a message. A typed phone is normalised to E.164, including the '(0)' trunk digit in '+44 (0)20 ...'. The real website travels as placeWebsite because 'website' on the request is the hidden honeypot, which the route drops when filled. The review comment on the generated PR asks the maintainer to confirm contact details against the place's own site.
Read from each library's own site on 2026-11-24: the British Library, Library of Congress, State Library of New South Wales, State Library Victoria, National Library of Ireland and National Library of Australia. A field is left out where the library's own page did not state it. Closes #356
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
2 tasks done
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
#356: three optional place fields, end to end. One commit per step.
website(anhttps://URL),phone(E.164, like+442074127000) andhours(short single-line text, at most 120 characters) are optional inplaces.schema.json, checked for format invalidate-places.mjs, and added to thePlacetype. No existing record needs them./api/placeshas no field whitelist, so it returns them unchanged (a test pins that).data/CONTRIBUTING.mddocuments them and adds the verification rule: phone and hours must come from the place's own site or listing, with the page and date checked in the PR.PlaceContactshows whichever of the three exist. Empty ones are hidden and a place with none renders exactly as before. The website links only when it is a well-formedhttpsURL; the phone becomes atel:link only in international form./api/submit-place, the issue body and the PR record all carry them; a blank field is left out and a malformed one gets a message. A typed phone is normalised to E.164, including the trunk(0)in+44 (0)20 .... The generated PR's review comment tells the maintainer the details came from the submitter and should be checked against the place's own site.One thing worth a look: the form's hidden anti-spam field is named
website, and the route silently drops any request where it is filled. A real website sent under the same key would have been thrown away, so the real value travels asplaceWebsite. A route test covers both: a filled honeypot is still dropped, and a realplaceWebsiteis filed.Type of change
Seed data: 6 of the 10 the issue asks for
I read each value on the library's own page today (2026-11-24) and left a field out where that page did not state it:
ldn-library-01)wdc-library-01)syd-library-01)mel-library-01)dub-library-02)cbr-library-01)The other four I tried (NYPL, Toronto, Boston, State Library of Queensland) are script-rendered or returned errors to a plain fetch, and I would not write hours from memory under a rule that says they must come from the place's own page. So the issue's "fill 10" is not fully met; the UI is exercised by the six above. The last commit says
Closes #356; please leave the issue open if you want the other four.Testing
npm run typecheck,npm run lint,npm run test:unit(816 tests),prettier --check .,npm run validateandnpm run check:freshnesspass.PlaceContactand the popup (each field, hidden when empty, unsafe URL not linked, unchanged render without them).library.jsonand nothing else.Not covered
Closes #356