Page MenuHomePhabricator

Modularize application transactions in Paste, mostly
ClosedPublic

Authored by epriestley on Jun 13 2016, 9:49 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Mar 22, 8:20 PM
Unknown Object (File)
Feb 3 2024, 10:50 AM
Unknown Object (File)
Jan 27 2024, 7:23 AM
Unknown Object (File)
Jan 26 2024, 7:57 PM
Unknown Object (File)
Dec 30 2023, 5:17 PM
Unknown Object (File)
Dec 27 2023, 7:29 AM
Unknown Object (File)
Dec 27 2023, 7:29 AM
Unknown Object (File)
Dec 27 2023, 7:29 AM
Subscribers

Details

Summary

Ref T9789. Transaction and Editor classes are the last major pieces of infrastructure that haven't been fully modularized.

Some of the specific issues are:

  • Editor classes rely on a bunch of instanceof stuff in the base class to pick up transaction types like "subscribe", "projects", etc. Instead, applications should be adding these, and third-party applications should be able to add them.
  • Code is spread across Transaction and Editor classes somewhat oddly. For example, generating old/new values would probably make more sense at the Transaction level, but it currently exists at the Editor level.
  • Both types of classes have a lot of functions based on switch() statements, which require a ton of boilerplate and are just generally kind of hard to work with.

This creates classes for each type of transaction, and moves almost all of the logic to them. These classes are simpler and more focused than the old stuff was, and can organize related code better.

This starts inching toward defining CoreTransactions for features shared across applications. It only defines the "Create" transaction so far, but at some point I plan to move all the other shared transactions to Core and let them control which objects they're available for.

Test Plan
  • Created pastes with web UI and API.
  • Edited all paste properites.
  • Archived/activated.
  • Verified files got reasonable names.
  • Reviewed timeline and feed.

Diff Detail

Repository
rP Phabricator
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

epriestley updated this revision to Diff 38765.
epriestley retitled this revision from to Modularize application transactions in Paste, mostly.
epriestley updated this object.
epriestley edited the test plan for this revision. (Show Details)
epriestley added a reviewer: chad.
  • Fix feed titles for object creation.
resources/sql/patches/20130801.pastexactions.php
3–5

I just nuked these since they aren't too interesting and aren't even correct anymore (in modern code, they should be TYPE_CREATE). Didn't seem worthwhile to try to update this since it's ancient.

src/applications/paste/editor/PhabricatorPasteEditor.php
36–38

The old version of this was weird. I blamed it and it looks like it got sort-of-broken at some point. The original intent was this (only send mail for updates, not for creation). We could take another look at this eventually, not sure if this rule makes sense in modern apps.

src/applications/paste/storage/PhabricatorPasteTransaction.php
26–42

I'm just not dealing with mail tags for now, not really sure what I want to do with them.

src/applications/paste/xaction/PhabricatorPasteLanguageTransaction.php
4

The "Content" transaction above has a lot going on, but the other three are how most transactions should look going forward. Feels a lot better to me than switch(...) stuff.

chad edited edge metadata.
This revision is now accepted and ready to land.Jun 13 2016, 10:37 PM
This revision was automatically updated to reflect the committed changes.

Paste comment transactions seem to have a borked Feed title here, guessing that's something from this that isn't hooked up yet?

https://secure.phabricator.com/feed/6296015785671195191/