Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Page MenuHomePhabricator

Special:NewFiles: Do date start/end swapping server-side instead of client-side
Closed, ResolvedPublic

Description

Follows-up on:

The added javascript code in mediawiki.special.newFiles.js says the interpretation of the values is already swapped as needed on submission (server-side), but the form is still rendered incorrectly and thus this is fixed up client-side.

This is needless client-side overhead and FOUC-like.

As of PS8 the values displayed are swapped in client JS. However, there is probably a way to do this server-side that I don't know about.

Let's explore a way to do this at run-time. I'd be nice to not keep this technical debt around for very long.

Event Timeline

A quick look into the code shows:

  • SpecialNewFiles constructs a FormOptions object and fills it with specification of available options.
  • SpecialNewFiles populates FormOptions using values from its context's WebRequest.
  • SpecialNewFiles swaps start and end, and correctly updates FormOptions to reflect these options.
  • SpecialNewFiles creates a NewFilesPager with the FormOptions object. The Pager is responsible for the results, but not the form.
  • SpecialNewFiles::buildForm() creates another set of specifications for available options, passes it to HTMLForm::factory, along with the current context.
  • HTMLForm uses the given context to fetch the values, not FormOptions.
dr0ptp4kt triaged this task as Medium priority.Jun 26 2017, 3:16 PM
dr0ptp4kt moved this task from Untriaged to Next up on the Multimedia board.

Change 363312 had a related patch set uploaded (by Matthias Mullie; owner: Matthias Mullie):
[mediawiki/core@master] Swap from/to date serverside

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

matthiasmullie lowered the priority of this task from Medium to Low.
matthiasmullie moved this task from Next up to Needs code review on the Multimedia board.

Change 363312 merged by jenkins-bot:
[mediawiki/core@master] SpecialNewFiles: Swap from/to date serverside

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