Page MenuHomePhabricator

Phriction - validateTransactions that need parent ancestry to complete successfully
ClosedPublic

Authored by btrahan on Dec 11 2014, 9:45 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Apr 25, 1:07 AM
Unknown Object (File)
Thu, Apr 25, 12:26 AM
Unknown Object (File)
Tue, Apr 16, 6:16 PM
Unknown Object (File)
Mon, Apr 8, 10:10 AM
Unknown Object (File)
Feb 19 2024, 10:04 AM
Unknown Object (File)
Feb 13 2024, 12:25 AM
Unknown Object (File)
Feb 9 2024, 4:46 AM
Unknown Object (File)
Jan 15 2024, 4:03 PM
Subscribers

Details

Summary

Fixes T6651, T6682. Since policy is defined by ancestry, you can't make things outside the core tree.

An alternative fix would be to automagically stub everything in these cases. This has potential negative policy implications - consider making a public document with several levels of depth that automagically stubs out its ancestry as public - and additionally the PhabricatorApplicationTransactionEditor framework would make this very tricky code (i.e. you are expected to validateTransactions in said hook *and* return an error if things aren't valid and not do some automagic stubbing, etc.)

Test Plan

tried to move a doc from location/that/exists to locationz/thatz/dontz/existz/ and got an error message with links to each missing doc. tried to create a doc at locatonz/thatz/dontz/existsz/ and got an error message with links to each missing doc.

Diff Detail

Repository
rP Phabricator
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

btrahan retitled this revision from to Phriction - validateTransactions that need parent ancestry to complete successfully.
btrahan updated this object.
btrahan edited the test plan for this revision. (Show Details)
btrahan added a reviewer: epriestley.
src/applications/phriction/editor/PhrictionTransactionEditor.php
527–558

I can consolidate this block to a function... its only change is create => move.

make a validateAncestry helper function to reduce the copy and paste action to nil

epriestley edited edge metadata.
epriestley added inline comments.
src/applications/phriction/editor/PhrictionTransactionEditor.php
652–661

Piecewise strings like this can't be translated in the general case -- you should ideally pass a constant instead, and then do something like:

switch ($operation) {
  case MOVE:
    return pht('entire string with move verb');
  case CREATE:
    return pht('entire string with create verb');
}
This revision is now accepted and ready to land.Dec 12 2014, 12:31 AM
btrahan edited edge metadata.

use a constant and construct strings properly

This revision was automatically updated to reflect the committed changes.