Page MenuHomePhabricator

Modularize Celerity postprocessors

Authored by epriestley on Jun 19 2015, 10:06 PM.
Referenced Files
Unknown Object (File)
Sat, Nov 25, 6:02 PM
Unknown Object (File)
Sat, Nov 25, 1:41 AM
Unknown Object (File)
Wed, Nov 15, 3:12 AM
Unknown Object (File)
Tue, Nov 14, 1:50 PM
Unknown Object (File)
Wed, Nov 1, 12:03 AM
Unknown Object (File)
Oct 18 2023, 9:26 AM
Unknown Object (File)
Oct 17 2023, 5:22 PM
Unknown Object (File)
Oct 15 2023, 9:20 PM
"Baby Tequila" token, awarded by chad."Evil Spooky Haunted Tree" token, awarded by joshuaspence."Love" token, awarded by tycho.tatitscheff."Like" token, awarded by btrahan.


Restricted Diffusion Commit
rPbb58a123e633: Modularize Celerity postprocessors

Not sure if we want this, but it seems to work fine.

Test Plan

contrast.png (1×1 px, 201 KB)

Diff Detail

rP Phabricator
Lint Not Applicable
Tests Not Applicable

Event Timeline

epriestley retitled this revision from to Modularize Celerity postprocessors.
epriestley updated this object.
epriestley edited the test plan for this revision. (Show Details)
epriestley added a reviewer: chad.

You can add more postprocessors to address other visual constraints by creating more classes like this one.


You can add more overrides here. Anything not specified will use the defaults.

(I have deliberately avoided the word "theme" or any implication that this feature is fun, but I can't stop anyone from building themes with it.)

chad edited edge metadata.
This revision is now accepted and ready to land.Jun 20 2015, 7:16 AM

The only other thing I can think of is letting people pull in an actual CSS file or define their own rules, but I suppose that is actual theming and this is just to make Phabricayor easier to read.

Or that admins might want to make this a default like base language.

A couple of really nitpicky inlines. There is some inconsistency in the use of postprocessor versus postProcessor, personally I feel that the latter is more correct, but you seem to have used the former in more places.


I feel like this method should be named setPostprocessorKey or that it should actually take an instance of CelerityPostprocessor.


Maybe name this $postprocessor for consistency with CelerityResourceTransformer


As above, I feel that this would be more correctly named setPostprocessorKey


As above.


You maybe got a bit carried away here :P


Maybe move this to CelerityPostprocessor as in PhabricatorEdgeType and PhabricatorPHIDType.


Maybe add a basic test class as in D13272. I haven't seen these tests catch any real issues yet, but theoretically it means that we will catch issues with two postprocessors having the same key.


I wonder if the "return the default postprocessor" logic should live here? Like, maybe CelerityPostprocessor::getPostprocessor(null) should just return the default. Also, maybe CelerityPostprocessor::getPostprocessor('nonexistent_key') should throw an exception


I've been wondering if we should make these fields final? This is probably more siginificant if/when we drop PHP 5.2 support and can use late static binding.

Or that admins might want to make this a default like base language.

They can default them both after T4103 (right now, no way to choose a default language either).

epriestley edited edge metadata.
    • Use Postprocessor consistently (I started with "PostProcessor" but it looked super weird after I typed it 5 times so I switched, but didn't clean them all up).
  • Remove ocean of whitespace between tiny island methods.
  • Added tests for getAll() not hitting key collisions.
  • Marked static methods final.
  • Use postprocessorKey() when we're passing a key.
  • Fix ajax.
  • Make high contrast colors more obvious.

I also made "default to DefaultPostprocessor" a rule in the base class. This feels a little dirty (the parent refers to a child symbol by name) but simplifies subclass implementations, and the default postprocessor is more special in this case than in most cases of modular subclasses.

As an aside, I also think we could probably write some kind of shared piece of "turn these objects into a map with unique keys and throw on collision" code, which is getting more common. I think the major difference between them is specializing the strings, but I think the error is usually pretty obvious when you hit it and it would be OK to have more generic strings.

Screen Shot 2015-06-20 at 6.07.51 AM.png (1×1 px, 247 KB)

This revision was automatically updated to reflect the committed changes.