Page MenuHomePhabricator

Allow creation and editing of events outside of event namespace in rest API
Closed, ResolvedPublic1 Estimated Story Points

Description

Acceptance criteria

Given that I have the event organiser role

When I create an event using the REST endpoint
AND the selected namespace is in the list configured in community configuration (T387966)
Then the event will be created successfully.

When I create or edit an event using the REST endpoint
AND the selected namespace is NOT in the list configured in community configuration (See: T387966)
Then the event will be NOT be updated successfully.
AND an error will returned with the text: The event page must be in one of the permitted namespaces.

When I edit an event using the REST endpoint
AND the event page namespace is NOT in the list of allowed namespaces
AND I do NOT modify the event page
Then the event will be edited successfully

When I edit an event using the REST endpoint
AND the event page namespace is NOT in the list of allowed namespaces
AND I modify the event page
AND the new event page is not in a permitted namespace
Then the event will be NOT be edited successfully
AND an error will be returned with the text: The event page must be in one of the permitted namespaces.

Event Timeline

MHorsey-WMF set the point value for this task to 3.Mar 6 2025, 1:25 PM

Change #1128454 had a related patch set uploaded (by Daimona Eaytoy; author: Daimona Eaytoy):

[mediawiki/extensions/CampaignEvents@master] Validate event page namespace when enabling registration

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

Daimona updated the task description. (Show Details)

Change #1128539 had a related patch set uploaded (by Daimona Eaytoy; author: Daimona Eaytoy):

[mediawiki/extensions/CampaignEvents@master] Skip event page namespace validation on edits when page is unchanged

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

Change #1128454 merged by jenkins-bot:

[mediawiki/extensions/CampaignEvents@master] Validate event page namespace when enabling registration

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

Change #1128539 merged by jenkins-bot:

[mediawiki/extensions/CampaignEvents@master] Skip event page namespace validation on edits when page is unchanged

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

Community configuration is not yet available, but this can be tested as a normal config setting, with something like $wgCampaignEventsEventNamespaces = [ NS_MAIN, NS_EVENT, NS_PROJECT ];.

vaughnwalters subscribed.

When I create an event using the REST endpoint
AND the selected namespace is in the list configured in community configuration (T387966)
✅ Then the event will be created successfully.
QA note - this is not released in community configuration yet, so I am testing this locally.

Screenshot 2025-04-03 at 11.05.37 PM.png (1×2 px, 208 KB)


When I create or edit an event using the REST endpoint
AND the selected namespace is NOT in the list configured in community configuration (See: T387966)
Then the event will be NOT be updated successfully.
✅ AND an error will returned with the text: The event page must be in one of the permitted namespaces.

POSTPUT
Screenshot 2025-04-03 at 11.07.00 PM.png (1×1 px, 241 KB)
Screenshot 2025-04-03 at 11.09.09 PM.png (1×1 px, 243 KB)

When I edit an event using the REST endpoint
AND the event page namespace is NOT in the list of allowed namespaces
AND I do NOT modify the event page
✅ Then the event will be edited successfully

Screenshot 2025-04-03 at 11.10.19 PM.png (1×1 px, 189 KB)


When I edit an event using the REST endpoint
AND the event page namespace is NOT in the list of allowed namespaces
AND I modify the event page
AND the new event page is not in a permitted namespace
Then the event will be NOT be edited successfully
✅ AND an error will be returned with the text: The event page must be in one of the permitted namespaces.

Screenshot 2025-04-03 at 11.14.00 PM.png (1×1 px, 245 KB)


@Daimona all AC is met, but the responses in the Enable and Edit in the docs need to be updated to also have a potential response of 400 and The event page must be in one of the permitted namespaces or something describing the 400 response in this ticket

@Daimona all AC is met, but the responses in the Enable and Edit in the docs need to be updated to also have a potential response of 400 and The event page must be in one of the permitted namespaces or something describing the 400 response in this ticket

That error falls under the "The event data is invalid" umbrella. There are about 30 different ways that this could happen and we didn't document them all.

@Daimona all AC is met, but the responses in the Enable and Edit in the docs need to be updated to also have a potential response of 400 and The event page must be in one of the permitted namespaces or something describing the 400 response in this ticket

That error falls under the "The event data is invalid" umbrella. There are about 30 different ways that this could happen and we didn't document them all.

Okay thanks, moving to product sign off