Page MenuHomePhabricator

Modularize workboard column orders

Authored by epriestley on Mar 11 2019, 4:56 AM.



Depends on D20267. Depends on D20268. Ref T10333. Currently, we support "Natural" and "Priority" orders, but a lot of the particulars are pretty hard-coded, including some logic in ManiphestTask.

Although it's not clear that we'll ever put other types of objects on workboards, it seems generally bad that you need to modify ManiphestTask to get a new ordering.

Pull the ordering logic out into a ProjectColumnOrder hierarchy instead, and let each ordering define the things it needs to work (name, icon, what headers look like, how different objects are sorted, and how to apply an edit when you drop an object under a header).

Then move the existing "Natural" and "Priority" orders into this new hierarchy.

This has a minor bug where using the "Edit" workflow to change a card's priority on a priority-ordered board doesn't fully refresh card/header order since the response isn't ordering-aware. I'll fix that in an upcoming change.

Test Plan

Grouped workboards by "Natural" and "Priority", dragged stuff around within and between columns, grepped for all touched symbols.

Diff Detail

rP Phabricator
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

epriestley created this revision.Mar 11 2019, 4:56 AM
epriestley requested review of this revision.Mar 11 2019, 4:58 AM
amckinley accepted this revision.Mar 12 2019, 7:47 PM
amckinley added inline comments.

Just because this looked like a typo while scrolling... This is the same as

(int) (-1 * $this->getPriority()), right?


No cast to int here?


As above, I slightly prefer (-1 * $priority), but this is fine.

This revision is now accepted and ready to land.Mar 12 2019, 7:47 PM
epriestley added inline comments.Mar 12 2019, 7:55 PM

Yeah. Some future diff swaps this to -(int)X which is arguably more intuitive than (int)-X even though I think they both do the same thing for all inputs since the unary - implies numeric cast.

The (int) in (int)-X isn't technically redundant because -"1.1" has type double.

This is all ultimately rooted in T12678.

Basically: kind of a goofy mess, cleaned up slightly in future changes, means the same thing as (int)((int)-1 * (int)$x), all the tricky cases end up working out for all actual inputs as long as (int) is in there somewhere.


(This was just being used to build a "priority(123)" string so the cast didn't actually matter, and I got rid of it in a future change by consolidating the string construction in PHP instead of spreading it out between PHP and JS.)

This revision was automatically updated to reflect the committed changes.