Page MenuHomePhabricator

When editing at "index.php?title=Page&veaction=edit" return to /wiki/Page instead of index.php
Closed, ResolvedPublic1 Estimated Story Points

Description

Follows-up T44553: VisualEditor: Only replace url on veaction=edit if there is no other query.

Previously, we sometimes replaced the url with the plain /wiki/Page article path when there were query parameters in the edit session. This was wrong and fixed by T44553. However it failed to account for the opposite case which is far more common. E.g. the user goes from /wiki/Page into /w/index.php?title=Page&veaction=edit. When exiting the editor the veaction parameter is removed, the user should go to /wiki/Page but the logic for T44553 is keeping the user on the index.php-style url because of there being "one or more" query parameters.

While the on-click handler for Edit moves the user to /wiki/Page?veaction=edit, the underlying html href (used when opening in a new tab) does go to index.php.

Let's exclude the "title" key from this query so that users are less likely to reside on non-canonical urls. Thus making it more likely that they end up reading the article over the canonical urls and share those with other people. This also improved caching and performance.

Event Timeline

Krinkle claimed this task.
Krinkle raised the priority of this task from to Needs Triage.
Krinkle updated the task description. (Show Details)
Krinkle subscribed.
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
nshahquinn-wmf set Security to None.

For what it's worth, I think I recall reading a discussion where it was decided to use URLs like /wiki/Page?veaction=edit instead of /w/index.php?title=Page&veaction=edit, which would remove the need for this change.

Change 218337 had a related patch set uploaded (by Krinkle):
mw.ViewPageTarget: Ensure canonial view url is restored

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

I don't know in which context that discussion took place, but for something relatively unimportant for users as urls, technical side-effects might trump that.

We've always had /wiki/Page?veaction=edit for the live interface from the Edit button. However that was never explicitly formed. That's just what happens by default in a browser when one appends a query parameter to the view url. Other urls explicitly formed by MediaWiki, always use index.php notation as soon as one or more query parameters is involved. That's been that way for many years and most software components we interact with will make those same assumptions.

We could change that convention for VisualEditor, but there'll still be a large body of existing content and infrastructure that generate urls based on index.php (gadgets, mw.Uri, mw.util, on-wiki templates etc.)

This task is about ensuring VisualEditor, upon switching back to read mode, will restore the address bar to the canonical "View page" url. If the url happens to already be that way, then that's fine. But it is not in VisualEditor's control to enforce that globally. And at least for the moment, urls featuring index.php, are quite common.

Change 218337 merged by jenkins-bot:
mw.ViewPageTarget: Ensure canonial view url is restored

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