Page MenuHomePhabricator

Window on leave code in editor overlay should be reusable or dropped
Closed, ResolvedPublic

Description

https://gerrit.wikimedia.org/r/190163 introduced code handling around losing edits when leaving the editor.

This is not reusable by things like the talk page overlay.

As @TheDJ points out there is http://git.wikimedia.org/blob/mediawiki%2Fcore.git/093bb2e23e7a984eee9c32be79058c6e6974a740/resources%2Fsrc%2Fmediawiki%2Fmediawiki.confirmCloseWindow.js
But we should also check this works on mobile.

Event Timeline

Jdlrobson raised the priority of this task from to Needs Triage.
Jdlrobson updated the task description. (Show Details)
Jdlrobson added a project: Readers-Web-Backlog.
Jdlrobson added subscribers: Jdlrobson, TheDJ.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMar 27 2015, 4:31 PM

(We may also want to consider dropping this code altogether - note that on mobile typically the only way to lose an edit is to close the window as there are no links to follow in the editor) or to change the URL in the address bar. To solve the latter we should use history replace state and store edits in history itself.

Jdlrobson renamed this task from Window on leave code in editor overlay should be reusable to Window on leave code in editor overlay should be reusable or dropped.Mar 27 2015, 4:33 PM
Jdlrobson set Security to None.
phuedx added a subscriber: phuedx.Apr 7 2015, 2:43 PM

See @Florian's efforts over at T88949.

Change 200179 had a related patch set uploaded (by Phuedx):
Use mediawiki.confirmCloseWindow

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

phuedx assigned this task to Florian.Apr 15 2015, 6:03 AM

Change 204538 had a related patch set uploaded (by Florianschmidtwelzow):
Extend mediaWiki.confirmCloseWindow with a custom event

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

Change 204538 merged by jenkins-bot:
Extend mediaWiki.confirmCloseWindow to trigger it manually

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

Change 200179 merged by jenkins-bot:
Use mediawiki.confirmCloseWindow

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

phuedx closed this task as Resolved.May 19 2015, 1:11 PM

@Florian: the code on mediawiki.special.preferences.js#277 (204538) is not working as intended, there should be no parentheses:

$( '#mw-prefs-form' ).submit( allowCloseWindow.release );
$( '#mw-prefs-restoreprefs' ).click( allowCloseWindow.release );

Tested on wikt:pl:Special:Preferences (1.26wmf6), it won't return any warning on window close after changing any preference without saving.

Florian reopened this task as Open.May 20 2015, 12:25 PM

goddamit! Thanks for the report! I'll upload a change later (in some hours), but if someone other is faster, feel free :D I think there are some different solutions:

$( '#mw-prefs-form' ).submit( function () {
    allowCloseWindow.release()
} );

or

$( '#mw-prefs-form' ).submit( $.proxy( allowCloseWindow, 'release' ) );

(After i took a short look :P)

Doing that now :)

Change 212334 had a related patch set uploaded (by Florianschmidtwelzow):
Fix Special:Preferences onBeforeUnload handler

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

Change 212334 merged by jenkins-bot:
Fix Special:Preferences onBeforeUnload handler

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

Is anyone willing to backport this and plan a SWAT for it? It isn't part of 1.26wmf7 and would need 2 weeks to find it's way on wikipedias :/ Normally i'm not able to be responsible for a swat (due to the :(). Or can we backport and SWAT deploy that in Lyon, maybe? :)

@Florian yeh let's work this out during the hackathon. If not @kaldari might be able to deploy it Monday

@Florian @Jdlrobson did anything happen with this?

Still not deployed...

phuedx closed this task as Resolved.May 28 2015, 8:01 AM

Our current process is to close tasks as Resolved that are still awaiting derployment. So…

Now it's deployed to all Wikipedias (in wmf7, which was deployed to group2 yesterday), btw.