Page MenuHomePhabricator

wgPostEdit is not set/updated after editing with VE or 2017 wikitext editor
Open, Needs TriagePublic

Description

Minimal test code:

mw.hook( 'postEdit' ).add( function() {
	console.log( mw.config.get( 'wgPostEdit' ) );
} );

This returns null in both VE and the 2017 wikitext editor.

Event Timeline

Vargas04 renamed this task from wgPostEdit does not work with VE or 2017 wikitext editor to Open.Dec 10 2019, 3:14 PM
Vargas04 triaged this task as Unbreak Now! priority.
Vargas04 renamed this task from Open to wgPostEdit does not work with VE or 2017 wikitext editor.Dec 10 2019, 3:14 PM
Vargas04 lowered the priority of this task from Unbreak Now! to Needs Triage.
Vargas04 triaged this task as Unbreak Now! priority.
Vargas04 updated the task description. (Show Details)
Jdforrester-WMF lowered the priority of this task from Unbreak Now! to Needs Triage.Dec 10 2019, 6:33 PM
Jdforrester-WMF subscribed.

Hello @ppelberg! The Campaigns team is interested in this ticket and was wondering if it could potentially be added to the Editing team's backlog? Basically, for our new event registration tool (see documentation), we have a feature where a pop-up appears after someone creates an event page in the event namespace (which asks if the user wants to enable registration on the page). I have attached a screenshot example below. This feature currently works if the user is creating an event page with the source editor. However, the pop-up does not appear if they create the event page with VE. From our understanding, the reason why is due to the work outlined in this ticket. In that case, do you think it would be possible for the Editing team to take on this work any time soon? Thank you in advance!

BTW, you can test the event registration feature on the beta cluster. It is not yet released to any live wikis, but we are planning to release to our first live wiki (Meta-wiki) around October. Also, we *do* have a work-around for users (the button to 'enable registration' is still displayed at the top of the page), but we would ideally like this fixed, if possible.

Example of correct behavior when an event page was created with source editor:

Screen Shot 2022-08-12 at 8.45.56 AM.png (828×1 px, 179 KB)

No pop-up displayed if event page created with VE:

Screen Shot 2022-08-12 at 8.50.35 AM.png (458×1 px, 113 KB)

Screen Shot 2022-08-12 at 8.51.01 AM.png (548×1 px, 109 KB)

Tagging @cmelo and @vyuen so they see this message.

Hello @ppelberg! The Campaigns team is interested in this ticket and was wondering if it could potentially be added to the Editing team's backlog....

Thank you for the ping, @ifried and for making it easy for me to understand and experience the issue you are describing for myself.

I'll talk this over with the Editing Team engineers and report back here with what work we think would be involved with fixing this and when we might be able to take on said work.

We don't set wgPostEdit (that could probably be adding to jsconfigvars in ApiVisualEditorEdit.php), but when we fire the postEdit hook, the target still exists, so you can check if it's a new page by looking at ve.init.target.pageExists.

https://www.mediawiki.org/wiki/Manual:Interface/JavaScript#wgPostEdit can also be restored but I don't think you're interested in that...

Esanders renamed this task from wgPostEdit does not work with VE or 2017 wikitext editor to wgPostEdit is not set/updated after editing with VE or 2017 wikitext editor.Aug 16 2022, 1:55 PM

Actually that won't work for page creations because we redirect setting venotify. We can set wgPostEdit when that happens though, based on venotify...

Change 823653 had a related patch set uploaded (by Esanders; author: Esanders):

[mediawiki/extensions/VisualEditor@master] DesktopArticleTarget: Set wgPostEdit when redirecting after save

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

The above patch partially resolves this issue by setting wgPostEdit when redirecting after save. As VE always redirects after save when creating a new page this should be sufficient for your use case @ifried, however wgPostEdit is still not set after edits to existing pages, so we should leave this task open.

Thank you for this patch and update, @Esanders! Much appreciated. cc @cmelo and @vyuen

Change 823653 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@master] DesktopArticleTarget: Set wgPostEdit when redirecting after save

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

Could this fix have caused T316726? The postEdit hook is now fired twice, which for event pages results in an unresponsive popup, and for ordinary pages in a double "Your edit was published" notification on page creation.

Hello @ppelberg, sorry to bug you on this again :) It looks like a bug appeared that is related to this ticket (see comment above). If the team could take a look when they get a chance, that would be great, and feel free to reach out if you have any questions. Thanks in advance!

Change 833453 had a related patch set uploaded (by Esanders; author: Esanders):

[mediawiki/extensions/VisualEditor@master] Follow-up Ieba322fd: Don't generate postedit notification now we set config var

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

The above patch fixes the double-firing issue, don't know if this fixes T316726 but should be easy enough to test.

Change 833453 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@master] Follow-up Ieba322fd: Don't generate postedit notification now we set config var

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

Change 997277 had a related patch set uploaded (by Bartosz Dziewoński; author: Esanders):

[mediawiki/extensions/VisualEditor@REL1_39] Follow-up Ieba322fd: Don't generate postedit notification now we set config var

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

Change 997277 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@REL1_39] Follow-up Ieba322fd: Don't generate postedit notification now we set config var

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