Page MenuHomePhabricator

Modularize Owners package transactions
ClosedPublic

Authored by yelirekim on Oct 3 2016, 5:58 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Dec 14, 7:21 AM
Unknown Object (File)
Sat, Dec 14, 2:57 AM
Unknown Object (File)
Sat, Dec 14, 2:01 AM
Unknown Object (File)
Thu, Dec 12, 7:04 AM
Unknown Object (File)
Thu, Dec 12, 4:22 AM
Unknown Object (File)
Mon, Dec 9, 10:57 PM
Unknown Object (File)
Mon, Dec 9, 10:57 PM
Unknown Object (File)
Mon, Dec 9, 1:24 PM
Subscribers

Details

Summary

Converts Owners package transactions to modular transactions.

Test Plan
  • created a new package
  • edited all simple properties from the web ui
  • checked that project and user owners were added as reviewers appropriately to new diffs
  • inspected the change details for various types of path add / remove / update / reorder changes

Diff Detail

Repository
rP Phabricator
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

yelirekim retitled this revision from to wip modular transactions for owners.
yelirekim updated this object.
yelirekim edited the test plan for this revision. (Show Details)

Couple of minor things but this all looks like it's headed in the right direction.

src/applications/owners/xaction/PhabricatorOwnersPackageDescriptionTransaction.php
17–19

With EditEngine, we don't need to do this stuff anymore -- it automatically folds transactions which apply at create time into an "X created this object" aggregate by default.

27–29

Likewise.

src/applications/owners/xaction/PhabricatorOwnersPackageNameTransaction.php
47

No more quotes required around values in the string -- we style them in the web UI and quote them in text email, so if you don't strip quotes it will generate sarcastic-looking double-quoted email.

yelirekim edited edge metadata.

finishing the gruntwork

I still have stylistic stuff to do throughout, I just focused on faithfully moving functionality out of the editor/transaction into the modular transactions here. There are a few things that don't work, haven't even looked at custom fields yet.

src/applications/owners/storage/PhabricatorOwnersPackageTransaction.php
13–14

This is probably not right, but it has nowhere to move. Is it even needed?

src/applications/owners/editor/PhabricatorOwnersPackageTransactionEditor.php
22–23

This has nowhere to go, should transactions types implement "has effect"?

src/applications/owners/editor/PhabricatorOwnersPackageTransactionEditor.php
22–23

This is OK to bring into ModularTransactions, but it might also be OK to just remove it completely. I'd expect no-op updates to already no-op correctly, and if you, say, reorder paths it seems OK to count that as a change? This might be vestigial from long ago.

I'd say:

  • Try deleting the code, see how bad no-op updates (edit paths, save without changes) and reorders (edit paths, reorder some, save) are.
  • If they're fine or fixable, just delete this code and tweak the title text or whatever.
  • If they're hard for some reason, port this into ModularTransactions as a new method.
src/applications/owners/storage/PhabricatorOwnersPackageTransaction.php
13–14

Should no longer be necessary. Getting rid of this was an explicit goal of ModularTransactions (and, generally, a goal in new code). It is replaced by HandlePools (e.g., via $viewer->loadHandles()) which just more-or-less do this correctly without requiring you to do any work.

The handle rendering methods in ModularTransaction use HandlePools automatically.

(This magic isn't completely transparent in all cases but it's pretty close.)

  • Fix display of quoted transaction values
  • Remove unneeded empty checks for create transactions
  • Remove getRequiredHandlePHIDs and transactionHasEffect methods
  • Use generateOldValue instead of getOldValue when applying external effects
yelirekim retitled this revision from wip modular transactions for owners to Modularize Owners package transactions.Oct 7 2016, 7:14 AM
yelirekim updated this object.
yelirekim edited the test plan for this revision. (Show Details)

This seems to work afaik. Still need to do custom fields and try this in conjunction.

src/applications/owners/xaction/PhabricatorOwnersPackageOwnersTransaction.php
22

I had to use generate here because the transaction doesn't have its storage attached at this point, I think? I got an exception from the web UI if I called getOldValue.

src/applications/owners/xaction/PhabricatorOwnersPackagePathsTransaction.php
102

Same deal as the owners transaction.

epriestley added a reviewer: epriestley.

I'll follow up on the get/generate thing after this lands.

src/applications/owners/xaction/PhabricatorOwnersPackageAutoreviewTransaction.php
14

Should be fine to just = array();, I wanted to move away from this "you have to call parent:: all the time" stuff as much as possible. There's at least one more of these elsewhere.

src/applications/owners/xaction/PhabricatorOwnersPackageOwnersTransaction.php
22

This is probably a ModularTransactions bug, but I can shoot you a followup. generate... instead of get... shouldn't really cause any issues.

This revision is now accepted and ready to land.Oct 11 2016, 7:01 PM
yelirekim edited edge metadata.

use array() instead of inheriting validation errors

This revision was automatically updated to reflect the committed changes.