Page MenuHomePhabricator

Make Special:AllEvents transcludable
Closed, ResolvedPublic

Description

Acceptance Criteria:

Given I am a wiki editor
When I am editing a wiki page
Then I will be able to transclude the Special:AllEvents page using the standard {{}} syntax
AND
When I transclude the Special:AllEvents page
Then I will not see the form section of the page
AND
Transclusion will accept parameters for all the available form filters, plus one for the result limit
AND
After the list of events or communities,
Add a line that says, "Explore more events and communities"
With the text linking to Special:AllEvents with the same filters applied.

Event Timeline

ifried updated the task description. (Show Details)

Change #1123002 had a related patch set uploaded (by Mhorsey; author: Mhorsey):

[mediawiki/extensions/CampaignEvents@master] Make AllEvents transcludable

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

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

[mediawiki/extensions/CampaignEvents@master] Make TextWithIconWidget use relative positioning

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

Change #1133261 merged by jenkins-bot:

[mediawiki/extensions/CampaignEvents@master] Make TextWithIconWidget use relative positioning

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

Daimona subscribed.

Code approved, marking the task as blocked as it needs to land in the wmf.25 train, in two weeks.

Change #1123002 merged by jenkins-bot:

[mediawiki/extensions/CampaignEvents@master] Make AllEvents transcludable

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

How do I include multiple filters, for example wpFilterTopics?

|wpFilterTopics=art|tv-and-film
|wpFilterTopics=tv-and-film
|wpFilterTopics=art

neither of these ways of doing it work, I probably have some kind of syntax error?

tagging @cmelo in on this comment too since he and I were trying to figure it out just now.

Also, If I include wpStartDate at all, with or without a date attached, then the upcoming / ongoing events section disappears.
To reproduce, include this in any page on betacluster:
{{Special:AllEvents|wpStartDate=2025-04-23}}

If I remove wpStartDate then upcoming and ongoing events sections reappear

Screen Recording 2025-04-25 at 3.45.34 PM.gif (1×2 px, 3 MB)

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

[mediawiki/extensions/CampaignEvents@master] Fix a bug when passing multiple options for wpFilterTopics and wpFilterWikis

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

How do I include multiple filters, for example wpFilterTopics?

|wpFilterTopics=art|tv-and-film
|wpFilterTopics=tv-and-film
|wpFilterTopics=art

neither of these ways of doing it work, I probably have some kind of syntax error?

tagging @cmelo in on this comment too since he and I were trying to figure it out just now.

Hi @vaughnwalters, I was checking the code, and it is a real bug, the issue is that when you use any of these filters (wpFilterTopics and/or wpFilterWikis), since they are multiple options, on the SpecialAllEvents you pass them like:

wpFilterTopics[]=art,music

and it works because is "automatically" send to the backend as an array like: ['art', 'music'] and that is what the code expect to work as it should.

But when we try the same on the transclusion it does not work this way, you can not pass wpFilterTopics[]=art,music there, instead we were using wpFilterTopics=art,music and the issue is that the backend receives an string like "art,music" instead of an array, and that is why it does not work properly.

So I added a custom verification for when the page is using transclusion so it transforms the string "art,music" into the array that the backend expects, I created a patch on gerrit to fix it.
@Daimona, @MHorsey-WMF let me know if there is another way to do it when using the transclusion, for the tests I did, adding these verifications for the 2 parameter I mention was the only solution that worked.

For the papertrail: the main problem here is that there is no way to specify array/vararg parameters in wikitext: T204366. So, to work around this limitation, we are making the "wiki" and "topic" parameters comma-separated lists of values when in transclusion mode.

Also, If I include wpStartDate at all, with or without a date attached, then the upcoming / ongoing events section disappears.
To reproduce, include this in any page on betacluster:
{{Special:AllEvents|wpStartDate=2025-04-23}}

If I remove wpStartDate then upcoming and ongoing events sections reappear

Screen Recording 2025-04-25 at 3.45.34 PM.gif (1×2 px, 3 MB)

Created a ticket to address this T392850

Change #1139211 merged by jenkins-bot:

[mediawiki/extensions/CampaignEvents@master] SpecialAllEvents: allow passing multiple topics and wikis when transcluding

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

How do I include multiple filters, for example wpFilterTopics?

|wpFilterTopics=art|tv-and-film
|wpFilterTopics=tv-and-film
|wpFilterTopics=art

neither of these ways of doing it work, I probably have some kind of syntax error?

tagging @cmelo in on this comment too since he and I were trying to figure it out just now.

Hi @vaughnwalters, I was checking the code, and it is a real bug, the issue is that when you use any of these filters (wpFilterTopics and/or wpFilterWikis), since they are multiple options, on the SpecialAllEvents you pass them like:

wpFilterTopics[]=art,music

and it works because is "automatically" send to the backend as an array like: ['art', 'music'] and that is what the code expect to work as it should.

But when we try the same on the transclusion it does not work this way, you can not pass wpFilterTopics[]=art,music there, instead we were using wpFilterTopics=art,music and the issue is that the backend receives an string like "art,music" instead of an array, and that is why it does not work properly.

So I added a custom verification for when the page is using transclusion so it transforms the string "art,music" into the array that the backend expects, I created a patch on gerrit to fix it.
@Daimona, @MHorsey-WMF let me know if there is another way to do it when using the transclusion, for the tests I did, adding these verifications for the 2 parameter I mention was the only solution that worked.


okay great, ty claudio this is working now using the following syntax
|wpFilterTopics=tv-and-film, physics

Screenshot 2025-04-29 at 1.48.42 PM.png (998×1 px, 123 KB)

One more question about transcluding the event list, if I want both ongoing and upcoming to be open, by doing something like |wpOpenSections=upcoming, ongoing this does not work. Is this expected that we should only be able to have one of the two sections open on page load?

One more question about transcluding the event list, if I want both ongoing and upcoming to be open, by doing something like |wpOpenSections=upcoming, ongoing this does not work. Is this expected that we should only be able to have one of the two sections open on page load?

It works if you follow the comma-separated syntax strictly, so no space between the names.

One more question about transcluding the event list, if I want both ongoing and upcoming to be open, by doing something like |wpOpenSections=upcoming, ongoing this does not work. Is this expected that we should only be able to have one of the two sections open on page load?

It works if you follow the comma-separated syntax strictly, so no space between the names.

Confirmed, ty

Given I am a wiki editor
When I am editing a wiki page
✅ Then I will be able to transclude the Special:AllEvents page using the standard {{}} syntax

{{Special:AllEvents}}

AND
When I transclude the Special:AllEvents page
✅ Then I will not see the form section of the page

Screenshot 2025-05-05 at 3.00.31 PM.png (1×1 px, 240 KB)

AND
✅ Transclusion will accept parameters for all the available form filters,

{{Special:AllEvents
|wpSearch=
|wpMeetingType=1
|wpFilterTopics=fashion,tv-and-film
|wpStartDate=2025-04-23
|wpFormIdentifier=campaignevents-allevents
|wpOpenSections=upcoming,ongoing
|wpFilterWikis=arwiki,dewiki
}}

✅ plus one for the result limit

{{Special:AllEvents
|limit=3
}}

note: this limit will apply only to the upcoming events

AND
After the list of events or communities,
✅ Add a line that says, "Explore more events and communities"
❌ With the text linking to Special:AllEvents with the same filters applied.
Created T393412 because if there are comma separated filters, then the values do not convey to Special:AllEvents

ifried subscribed.

This has been released. I'm marking it as done.