Page MenuHomePhabricator

Create fields validation for Edit Event Registration API
Closed, ResolvedPublic3 Estimated Story Points

Description

As a Dev I want to create validations for the form fields.

Acceptance Criteria:

All fields can be edited
All fields must apply the validations listed here:
https://docs.google.com/spreadsheets/d/1J-tZAunx4mtJk3RGXYa9p4UuG1cpg8XhoCIcNx-dmcY/edit#gid=1447326311

Event Timeline

Change 774866 had a related patch set uploaded (by Cmelo; author: Cmelo):

[mediawiki/extensions/CampaignEvents@master] Edit event registration API and special page

https://gerrit.wikimedia.org/r/774866

Change 774866 merged by jenkins-bot:

[mediawiki/extensions/CampaignEvents@master] Edit event registration API and special page

https://gerrit.wikimedia.org/r/774866

ifried added subscribers: โ€ข vyuen, Daimona, ifried.

This may also be good for QTE. Do you agree, @Daimona & @vyuen?

Nothing for me to test, so I'll mark this as Done.

This may also be good for QTE. Do you agree, @Daimona & @vyuen?

Yep

Hey @cmelo and @ifried, here are some API validation errors I found for Edit Event Registration when checking against the spreadsheet listed in the Acceptance criteria. Some of these we may just need to update the spreadsheet, or for some of them we may need to create bug tickets. My findings:

ce_event_start_date_time

Must be a date time format ('M-D-Y H:M')
-> the format that the API currently takes is Y-M-D H:M:S

Must be bigger than the current date
-> I was able to enter today's date or a date in the past and successfully edit a registration without triggering a validation error
->can enter "start_time": "2020-06-12 12:12:13", for example


ce_event_end_date_time
Must be a date time format ('M-D-Y H:M')
-> the format that the API currently takes is Y-M-D H:M:S

Must be bigger than the current date
-> I was able to enter today's date or a date in the past and successfully edit a registration without triggering a validation error (as long as end date was still after the start date, even if both in the past)
->can enter "end_time": "2020-06-12 12:12:13", for example


ce_event_timezone

Must not be empty

-> this is not required by the API and according to this spreadsheet it should be


ce_event_country
Must be a valid country name
-> This will currently take any string, it doesn't need to be a a valid country name currently. For example, I tested with (' %$&...)?


ce_event_chat_group_invite_link
If not empty Must be a valid URL
-> we need to update our validation or regex on this. For example, I was able to use this URL and it was validated, but is not a valid URL:

htp://f('_%$&...)

Additional Notes:
status
-> this field is currently required by the API but is not documented in the validation spreadsheet

Meeting URL
in the UI, the field Meeting URL
I am able to post an invalid URL and it is accepted as valid.
htp://f('_%$&...)


So, not sure which of these will need bug tickets and which just need the spreadsheet updated if yall could weigh in on that?

Hey @cmelo and @ifried, here are some API validation errors I found for Edit Event Registration when checking against the spreadsheet listed in the Acceptance criteria.

Uh-oh, that spreadsheet is outdated and should be ignored. I thought I had removed any reference to it from API-related tasks and added warnings to each sheet, but I apparently forgot this one. Sorry about that.

ce_event_start_date_time

Must be a date time format ('M-D-Y H:M')
-> the format that the API currently takes is Y-M-D H:M:S

I'm actually surprised that this format works, since it should be YmdHis (like 20220614231354), but I guess it's a good thing. Same for the end date.

Must be bigger than the current date
-> I was able to enter today's date or a date in the past and successfully edit a registration without triggering a validation error
->can enter "start_time": "2020-06-12 12:12:13", for example

This specific check was recently removed when for edits. Same for the end date.

ce_event_timezone

Must not be empty

-> this is not required by the API and according to this spreadsheet it should be

This one was removed and the time should be in UTC.

ce_event_country
Must be a valid country name
-> This will currently take any string, it doesn't need to be a a valid country name currently. For example, I tested with (' %$&...)?

Yeah, validation of country names is blocked on the geocoding stuff (T309325).

ce_event_chat_group_invite_link
If not empty Must be a valid URL
-> we need to update our validation or regex on this. For example, I was able to use this URL and it was validated, but is not a valid URL:

htp://f('_%$&...)

This seems a genuine bug. We're just using PHP's FILTER_VALIDATE_URL, so maybe it's just PHP being silly? What seems to be happening is that PHP does not recognize the scheme ("htp"), and thus doesn't really validate the rest of the URL. There's a somewhat related note in the manual. I think we may want to validate the scheme first, then the rest of the URL. Same for the meeting URL. I've just created https://gerrit.wikimedia.org/r/c/mediawiki/extensions/CampaignEvents/+/805487.

okay got it @Daimona i'll mark this as complete then since that is the only bug ticket that needs created