Page MenuHomePhabricator

Disable section editing on non current revision
Closed, ResolvedPublic

Description

Currently editing section on old revision is superficially disabled, in the sense that the section edit links are suppressed. However it's not technically disallowed; if you manipulate the url and append &section=xx you'll be able to edit the old revision section but that would almost always lead to unwanted result.

Example: https://en.wikipedia.org/w/index.php?title=Wikipedia:Sandbox&action=edit&oldid=954472043&section=3

Entire editing of old revision &action=edit&oldid=xx is also almost always unwanted because it would overwrite all revisions that came afterwards. The only legitimate use of that is for total revert to earlier version; but for section editing it's not clear if there's any way that it could be useful.

It could lead to bug though, for instance when the current revision and the fetched revision have different support status for section editing: T161199.

Since there's no legitimate use and the norm has always been that old revision sections are not editable, this should just be really enforced.

@Anomie wrote:
This seems to be begging the question: should it even be allowed to try to edit a section on an old revision of the page? The UI doesn't offer section edit links when editing an old revision, and when viewing the current revision doesn't include an "oldid" parameter in the section edit links.
And when I try a section edit of an old revision, that seems to be a very good way to accidentally overwrite one section with another because later edits resulted in the section numbers changing.
Perhaps instead of trying to test both the page's model (== the current revision's model) and the oldid-specified revision's model, we should just declare section editing unsupported whenever $this->mArticle->getRevIdFetched() !== $this->editRevId.[1]

Event Timeline

Change 584573 had a related patch set uploaded (by Ammarpad; owner: Ammarpad):
[mediawiki/core@master] Disallow secition edit on non-current revision.

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

Change 584573 abandoned by Ammarpad:
[mediawiki/core@master] Disable section editing on non-current revision.

Reason:

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

Change 584573 restored by Ammarpad:
[mediawiki/core@master] Disable section editing on non-current revision.

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

Change 584573 merged by jenkins-bot:
[mediawiki/core@master] Disable section editing on non-current revision.

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

Ammarpad claimed this task.