Page MenuHomePhabricator

Improve mediawiki.special.movePage.js to remove the namespace name when the user paste the full target name in the field
Open, MediumPublicFeature

Description

Previous to r110209, a user could

  1. Copy/paste the full name of the target page to the field
  2. Move the page

Now, this requires two extra steps:

  1. Copy/paste the full name of the target page to the field
  2. Select the namespace part
  3. Delete it
  4. Move the page

E.g.:
On [[Special:MovePage/Help:Moving]] we could paste "Help:Moving articles" and it would work. Currently we need to split the title parts like this:
https://en.wikipedia.org/wiki/Special:MovePage/Help:Moving?wpNewTitle=Help:Moving_articles
and then move.

I believe a small JS code could split the name when the user paste it in that field, and automatically select the appropriated namespace.


Version: 1.19
Severity: enhancement
See Also:

Details

Reference
bz34848

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 12:14 AM
bzimport set Reference to bz34848.
bzimport added a subscriber: Unknown Object (MLST).

Copy/paste fail. I mean r110209.

What if I actually want a page [[Wikipedia:Wikipedia:Foo]]?

Created attachment 10171
Example

(In reply to comment #2)

What if I actually want a page [[Wikipedia:Wikipedia:Foo]]?

Take a look in the attached example. It will select the "Wikipedia" namespace and change the text to "Wikipedia:Foo". I've tested on Google Chrome's console.

Attached:

How can you tell that's what the user wants ?

I know some wikis have pages like "Category:Wikipedia:Foobar" or "Wikipedia:Category:Foo".

When on "Wikipedia:Foo" and wanting to move it to "Wikipedia:Category:Foo" and you'd paste "Category:Foo" in the title field, then it shouldn't change the namespace selector.

Also to parse titles, use mw.Title.

(In reply to comment #4)

How can you tell that's what the user wants ?

I know some wikis have pages like "Category:Wikipedia:Foobar" or
"Wikipedia:Category:Foo".

When on "Wikipedia:Foo" and wanting to move it to "Wikipedia:Category:Foo" and
you'd paste "Category:Foo" in the title field, then it shouldn't change the
namespace selector.

Ok. So, maybe it would be better to ask the user?
In your example, after the text "Category:Foo" is pasted in the title field,

the script would aks something like this:

Do you want to move the page to which of these names?

  • Category:Foo
  • Wikipedia:Category:Foo ----

Also to parse titles, use mw.Title.

I didn't read its code yet, but I'll do for next time =)
PS: this needs to be documented on
https://www.mediawiki.org/wiki/ResourceLoader/Default_modules

a.d.bergi wrote:

proposed patch

Use of regexp and setTimeout is horrible. However, I'm not quite sure whether a wikiUrlencode for the namespace is useful or not.

My patch comes from my solution at [[de:WP:TSW#Seiten verschieben]].

Attached:

sumanah wrote:

Bergi, thank you for your patch. Can I ask you to use developer access to directly suggest it into our Git source control system?

https://www.mediawiki.org/wiki/Developer_access

https://www.mediawiki.org/wiki/Git/Workflow#How_to_submit_a_patch

sumanah wrote:

Bergi: ping re submitting this into Git.

You're free to submit through git review, but note that at the moment I think implementation details are still to be discussed first - or at least the implementation proposed so far should be implemented.

Notes:

  • Asking the user sounds good (this was your idea), however the patch applied does not do that (yet).
  • It being a minor convenience feature, it is important that it certainly does not introduce new bugs. So I think we should either implement this by asking the user in case of ambiguity or not implement it at all.
  • And, again, to parse titles use mw.Title.
  • To bind an event for one trigger only .one() may be useful, see also http://api.jquery.com/one. At least unbind it instead of having the function execute still on every change when it is no longer needed. That removes the need of this boolean state keeper.

In reply to comment #9)

  • It being a minor convenience feature, it is important that it certainly does

not introduce new bugs. So I think we should either implement this by asking
the user in case of ambiguity or not implement it at all.

I would say its absence is actually an inconvenient bug, because from time to time I see people doing this:
https://pt.wikipedia.org/wiki/Wikipedia:Projetos/Música/Bandas/matriz?action=history&uselang=en

He7d3r set Security to None.
Aklapper changed the subtype of this task from "Task" to "Feature Request".Feb 4 2022, 12:24 PM
Aklapper removed a subscriber: Kosikfl.