Page MenuHomePhabricator

Ask the user to save changes before leaving page when PagelistWidget has changes
Closed, ResolvedPublic

Description

Currently, the Pagelist Widget doesn't do anything when a user closes the tab/navigates away while having unsaved changes.

We should trigger browser's default unsaved changes dialog when a user navigates away/closes the tab while still having un-inserted changes in the Pagelist Widget

P.S: We should use MediaWiki's mw.confirmCloseWindow() api to implement this.

Documentation

Event Timeline

For context, in both of the models, the method updateCachedDataFromMainModel() is used to initialize the model with data, when the dialog is opened and unloadCachedData() is called when the dialog is closed.

@Iamumangg: I don't think that removing someone else as an assignee without consent is common; did CipherGirl agree to this beforehand?

Hey it's okay to claim, I'm no longer looking into this.

Aklapper added a subscriber: Iamumangg.

@Iamumangg: Per emails from Sep18 and Oct20 and https://www.mediawiki.org/wiki/Bug_management/Assignee_cleanup , I am resetting the assignee of this task because there has not been progress lately (please correct me if I am wrong!). Resetting the assignee avoids the impression that somebody is already working on this task. It also allows others to potentially work towards fixing this task. Please claim this task again when you plan to work on it (via Add Action...Assign / Claim in the dropdown menu) - it would be welcome. Thanks for your understanding!

Change #1053788 had a related patch set uploaded (by Aditya0545; author: Aditya0545):

[mediawiki/extensions/ProofreadPage@master] PagelistWidget: Trigger browser's unsaved changes dialog on page/tab close

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

Hi, I’m new and would like to work on this task as my first contribution. Can I be assigned?

@Somyaya: Welcome! Please first read the "New Developers" page on mediawiki.org and its Communication Tips section. Also see above that there is already a patch which needs rework. Thanks!

I’m working on this task and have implemented the unload warning using mw.confirmCloseWindow() in both VisualDialogModel.js and WikitextDialogModel.js.
A patch will be submitted shortly via Gerrit.

Change #1226248 had a related patch set uploaded (by Codeurluce; author: Codeurluce):

[mediawiki/extensions/ProofreadPage@master] PagelistWidget: warn on unsaved changes before window close

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

This comment was removed by Codeurluce.

Change #1226248 merged by jenkins-bot:

[mediawiki/extensions/ProofreadPage@master] PagelistWidget: warn on unsaved changes before window close

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

Change #1053788 abandoned by Sohom Datta:

[mediawiki/extensions/ProofreadPage@master] PagelistWidget: Trigger browser's unsaved changes dialog on page/tab close

Reason:

alternative fix merged

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