Fixed booking bug with a quote in the organiser name

This commit is contained in:
Tom Sydney Kerckhove 2024-03-28 19:07:01 +01:00
parent 51f0929811
commit 79f4b23e4d
5 changed files with 45 additions and 18 deletions

View File

@ -379,11 +379,11 @@
"ical": {
"flake": false,
"locked": {
"lastModified": 1701881999,
"narHash": "sha256-tMw9s2qI9jAs8tUHfam11u1rZo4Sjs95BWcX8S55RKs=",
"lastModified": 1711669230,
"narHash": "sha256-4urRUX+DBkFnT1FxwkpfBeNDbNQEgT/jVhn2AHf61PE=",
"owner": "NorfairKing",
"repo": "ical",
"rev": "601ff6dd9e48e87fec524056e2e7e2234aabe147",
"rev": "34acdf5e6df3aa1a3fdeb96e2870af179177d6da",
"type": "github"
},
"original": {
@ -490,11 +490,11 @@
},
"nixpkgs_2": {
"locked": {
"lastModified": 1711124224,
"narHash": "sha256-l0zlN/3CiodvWDtfBOVxeTwYSRz93muVbXWSpaMjXxM=",
"lastModified": 1711460390,
"narHash": "sha256-akSgjDZL6pVHEfSE6sz1DNSXuYX6hq+P/1Z5IoYWs7E=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "56528ee42526794d413d6f244648aaee4a7b56c0",
"rev": "44733514b72e732bd49f5511bd0203dea9b9a434",
"type": "github"
},
"original": {
@ -606,11 +606,11 @@
"nixpkgs-stable": "nixpkgs-stable_2"
},
"locked": {
"lastModified": 1711409088,
"narHash": "sha256-+rTCra8TY4vuSNTtQ0tcex1syCRPoKyb8vyHmoxkga4=",
"lastModified": 1711519547,
"narHash": "sha256-Q7YmSCUJmDl71fJv/zD9lrOCJ1/SE/okZ2DsrmRjzhY=",
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "db656fc3e34907000df26e8bc5cc3c94fb27f353",
"rev": "7d47a32e5cd1ea481fab33c516356ce27c8cef4a",
"type": "github"
},
"original": {
@ -672,11 +672,11 @@
"safe-coloured-text_2": {
"flake": false,
"locked": {
"lastModified": 1711451746,
"narHash": "sha256-anR90ESjXuKTrsb9/VEtHtRi+JkxA/3Y+x6N4IayRQs=",
"lastModified": 1711626793,
"narHash": "sha256-Pu7cKBjljx7wY4OoQ6T6Uu92+Hsj2SnuutYsVN3U89A=",
"owner": "NorfairKing",
"repo": "safe-coloured-text",
"rev": "67b2d81b41b44bc4a6f6f17180f89714796bde40",
"rev": "4161e707b1b0a8090a7149b8195f15943fa29fa9",
"type": "github"
},
"original": {

View File

@ -1,3 +1,4 @@
### Changed
* Fixed that casts weren't showing up on the docs site.
* Fixed that booking would show an error when a quote was used in the organiser name.

View File

@ -88,8 +88,8 @@ spec = do
Right _ -> expectationFailure "should not have succeeded."
describe "Golden" $ do
let now = UTCTime (fromGregorian 2023 04 22) (timeOfDayToTime (TimeOfDay 13 00 00))
uuid = Typed.UUID $ UUID.fromWords 1 2 3 4
let t = UTCTime (fromGregorian 2023 04 22) (timeOfDayToTime (TimeOfDay 13 00 00))
u = Typed.UUID $ UUID.fromWords 1 2 3 4
bc =
BookingSettings
{ bookingSettingName = "Example User Name",
@ -111,10 +111,16 @@ spec = do
bookingDuration = 30,
bookingExtraInfo = Just "This is extra info for the user\nOn\nMultiple\nLines."
}
describe "makeICALCalendar" $ do
it "Always produces a valid calendar" $
forAllValid $ \now ->
forAllValid $ \uuid ->
forAllValid $ \settings ->
forAllValid $ \booking ->
shouldBeValid $ makeICALCalendar now uuid settings booking
describe "makeICALCalendar" $
it "produces the same calendar as before" $
pureGoldenTextFile "test_resources/booking/calendar.ics" (renderICalendar [makeICALCalendar now uuid bc b])
pureGoldenTextFile "test_resources/booking/calendar.ics" (renderICalendar [makeICALCalendar t u bc b])
describe "makeEmailSubject" $
it "produces the same email subject as before" $
@ -135,4 +141,4 @@ spec = do
it "produces the same email as before" $
pureGoldenStringFile "test_resources/booking/email.mime" $
ppShow $
makeBookingEmail "booking@smos.online" bc b [makeICALCalendar now uuid bc b]
makeBookingEmail "booking@smos.online" bc b [makeICALCalendar t u bc b]

View File

@ -86,6 +86,26 @@ spec = do
addPostParam "utc-time-of-day" $ T.pack $ formatTime defaultTimeLocale "%H:%M" $ TimeOfDay 16 00 00
statusIs 200
it "POSTs a 200 for a succesful booking even with an annoying name" $ \yc ->
withAnyFreshAccount yc $ \username password -> do
setupBookingSettings username password dummyBookingSettings
get $ BookUserR username
statusIs 200
now <- liftIO getCurrentTime
let today = utctDay now
let tomorrow = addDays 1 today
request $ do
setMethod "POST"
setUrl $ BookUserDetailsR username
addPostParam "client-name" "Jane \"Foster\" Doe"
addPostParam "client-email-address" "jane@example.com"
addPostParam "client-timezone" "UTC"
addPostParam "duration" "30"
addPostParam "utc-day" $ T.pack $ formatTime defaultTimeLocale "%F" tomorrow
addPostParam "utc-time-of-day" $ T.pack $ formatTime defaultTimeLocale "%H:%M" $ TimeOfDay 16 00 00
statusIs 200
dummyBookingSettings :: BookingSettings
dummyBookingSettings =
BookingSettings

View File

@ -64,7 +64,7 @@ extra-deps:
- conformance-gen
- github: NorfairKing/ical
commit: 5d2ad0d37d04d0110d922dd88a4304e70d268dba
commit: 34acdf5e6df3aa1a3fdeb96e2870af179177d6da
subdirs:
- ical
- ical-gen