Page MenuHomePhabricator

Make undo work with multiple slots.
Open, LowPublic

Description

When using the "undo" function to undo an edit (or a series of edits), changes to all slots should be undone, not just changes to the main slot. The editable slots should be made available for additional editing, as is currently the case for (most) single-content revisions.

At present, undo redirects to a special action that displays a diff with no editing capability when non-main slots are involved, see T200216: Make undo work with SDC by showing a UI to confirm undo without allowing an edit.

Implementing this will depend on the updating of the edit form itself to be able to handle multiple slots. At a high level, the edit form takes serialized Content data for each slot to populate the form. The initial loading of the page (e.g. from an edit link) generally gets this data from a saved revision. When the user requests a preview or diff, it gets this data from the user's submission. An undo would get the data from the Content objects returned by ContentHandler::getUndoContent().

Note that not all content models support direct editing of the content (see ContentHandler::supportsDirectEditing). The undo content for such slots must be preserved through the process of displaying the edit form, displaying any previews and diffs requested by the user, and finally saving the edit. The "edit" interface for such slots should probably display a diff or other indication that changes will be made to the slot. Any previews and diffs requested by the user while editing should include the changes to the uneditable slots.

Related Objects

StatusSubtypeAssignedTask
Declineddchen
OpenNone
OpenNone
DuplicateNone
OpenFeatureNone
OpenBUG REPORTNone
OpenNone
StalledNone
OpenFeatureNone
DuplicateNone
ResolvedNone
OpenNone
OpenNone
OpenFeatureNone
OpenNone
ResolvedNone
ResolvedNone
OpenFeatureNone
OpenNone
OpenFeatureNone
StalledNone
OpenNone
OpenNone
Resolveddaniel
DuplicateNone
ResolvedAnomie
ResolvedAnomie
ResolvedTgr
ResolvedTgr

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes

The logic for determining the Content object for the undo based on the supplied 'undo' and 'undoafter' URL parameters looks like it's already in ContentHandler::getUndoContent(). EditPage calls through the stub in WikiPage, while ApiEditPage calls ContentHandler directly.

But note that the logic for undoing edits via the web UI ends with displaying the edit form with the undo content loaded (or not, if there's a "merge" conflict), so this probably depends on T174033: Refactor EditPage to allow multiple slots to be edited atomically [MCR].

Perhaps free form editing can be dropped from the undo function completely.

That sounds like a "torches and pitchforks" type of change.

EditPage will already have to deal with not-editing slots that aren't directly editable, all this would mean is the not-editing carrying forward the Content object from ContentHandler::getUndoContent() instead of inheriting the slot. We'll probably need to do something similar anyway for when someone edits an old revision rather than the current one.

When the undo operation spans multiple slots, free form editing should be disabled.

Same.

As a baseline, undo operations could just be denied of they would affect any slots other than the main slot.

That's probably the most straightforward approach until T174033 is done. Although the Commons editor community might consider that a blocker to SDC deployment.

daniel renamed this task from Make action=undo work properly with multiple slots. to Make action=undo work with multiple slots..May 15 2018, 10:03 AM
daniel removed a project: Epic.
daniel updated the task description. (Show Details)
daniel updated the task description. (Show Details)
daniel updated the task description. (Show Details)

When you are undoing past edits (ie. the "new" end of the undo range is not the current edit), the undo operation creates a content (array of contents, post-MCR) that does not exist on disk. That content needs to be presented to the user and then saved. Currently, EditPage just displays that content in the edit form; adding support for undo-without-edit would be nontrivial work, while multi-slot editing gives you multi-slot undo for free. (OTOH maybe we need undo-without-edit anyway if some slots don't support editing but support undo?)

maybe we need undo-without-edit anyway if some slots don't support editing but support undo?

Yes. This is already the case for SDC. MediaInfo does not support direct editing. Wikibase has its own implementation of edit=undo, which just shows a diff (no content view). But that also only works with the main slot.

I note there's no reason the edit form with the undo content would have to actually be editable for any particular field or having the raw content of that field being displayed to the user, as long as the preview and show changes functions work sensibly. In the extreme case, an "undo without edit" could have all fields' content as <input type="hidden"> or as data stored in the session server-side.

an "undo without edit" could have all fields' content as <input type="hidden"> or as data stored in the session server-side.

No need for even that, all data is already stored on the server side.

daniel lowered the priority of this task from Medium to Low.Jul 13 2018, 4:56 PM
daniel renamed this task from Make action=undo work with multiple slots. to Make undo work with multiple slots..Jul 13 2018, 6:48 PM
daniel updated the task description. (Show Details)

Change 447099 had a related patch set uploaded (by Anomie; owner: Anomie):
[mediawiki/core@master] MCR: Add temporary web UI mcrundo action

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

Thanks for catching that! It should not block T194750: Deploy Structured Data on Commons baseline .

I think we went back and forth on this a few times, and ended up pulling it into phase 2. We can drop it again, but it'S nearly finished anyway.

The latest decision, on July 23, was to pull it back out of phase 2 again.

It's not clear to me what this task is about. It mostly seems to describe T200216: Make undo work with SDC by showing a UI to confirm undo without allowing an edit (which got merged). Is it about doing the same thing from within EditPage (or whatever it gets refactored to), without the redirect hack?

The task was originally a combination of "make undo fully work, including editing of directly-editable slots" and the hack for SDC that was eventually split into T200216, plus some musing on the feasibility of fundamentally changing how undo works that I'm sure would not fly with our on-wiki editor communities.

I'm going to rewrite it to reflect only the bit that wasn't split out, and remove the aforementioned musing.