Page MenuHomePhabricator

Toplinks broken when redirected from Edit Counter
Closed, ResolvedPublic

Description

Visit https://xtools.wmflabs.org/ec/enwiki/Matthewrbowker, then scroll down to "Latest global edits." Choose the "Top Edits" link for "User:Matthewrbowker/Sandbox/List of Apollo missions."

Expected result: Top Edits information is shown.

Actual result: "No matching results found for: User:Matthewrbowker/Sandbox/List of Apollo missions "

Event Timeline

Looks we just need to strip out the namespace: https://xtools.wmflabs.org/topedits/enwiki/Matthewrbowker/2/Matthewrbowker/Sandbox/List%20of%20Apollo%20missions

Ideally we could omit the namespace portion of the route entirely if we are linking to a page. So the topedits-article route would be something like /topedits/wiki/username//full_page_title. If the namespace is given I guess it'd get priority and act like it does now

Indeed. The link given actually is looking for "User:User:Matthewrbowker/Sandbox/List of Apollo Missions" which has just a little too much "User:"

Ideally we could omit the namespace portion of the route entirely if we are linking to a page. So the topedits-article route would be something like /topedits/wiki/username//full_page_title. If the namespace is given I guess it'd get priority and act like it does now

I like that, but I'm concerned that the double-slash will confuse the Symfony routing. How about a * character? "/topedits/wiki/username/*/full_page_title" which should then redirect to "/topedits/wiki/username/namespace/page_title"

The link given actually is looking for "User:User:Matthewrbowker/Sandbox/List of Apollo Missions" which has just a little too much "User:"

I see https://xtools.wmflabs.org/topedits/enwiki/Matthewrbowker/2/User:Matthewrbowker/Sandbox/List%20of%20Apollo%20missions. It says User:User: for you?

I'm concerned that the double-slash will confuse the Symfony routing. How about a * character? "/topedits/wiki/username/*/full_page_title" which should then redirect to "/topedits/wiki/username/namespace/page_title"

You should be able to use the requirements directive in the @Route annotation, e.g.

@Route(
    "/topedits/{project}/{username}/{namespace}/{article}",
    name="TopEditsResults",
    requirements={"namespace" = "|all|\d+", "article" = ".+"}
)

where |all|\d+ allows blank, "all" or a number.

Matthewrbowker moved this task from Backlog to Working on the XTools board.

The link given actually is looking for "User:User:Matthewrbowker/Sandbox/List of Apollo Missions" which has just a little too much "User:"

I see https://xtools.wmflabs.org/topedits/enwiki/Matthewrbowker/2/User:Matthewrbowker/Sandbox/List%20of%20Apollo%20missions. It says User:User: for you?

From when I was working in TopEdits, I recall the 2 being deconstructed into the namespace. Therefore, it is looking for the User:User: combination. We're saying the same thing different ways!

I'm concerned that the double-slash will confuse the Symfony routing. How about a * character? "/topedits/wiki/username/*/full_page_title" which should then redirect to "/topedits/wiki/username/namespace/page_title"

You should be able to use the requirements directive in the @Route annotation, e.g.

@Route(
    "/topedits/{project}/{username}/{namespace}/{article}",
    name="TopEditsResults",
    requirements={"namespace" = "|all|\d+", "article" = ".+"}
)

where |all|\d+ allows blank, "all" or a number.

I like that. I'll take a look at some point over the next few days.