Page MenuHomePhabricator

Hard code a "close task" action on every column Trigger
ClosedPublic

Authored by epriestley on Mar 15 2019, 5:10 PM.
Tags
None
Referenced Files
F14451533: D20288.id48427.diff
Fri, Dec 27, 5:06 AM
F14447936: D20288.diff
Thu, Dec 26, 2:58 PM
Unknown Object (File)
Wed, Dec 25, 6:06 PM
Unknown Object (File)
Sun, Dec 15, 3:54 PM
Unknown Object (File)
Sun, Dec 15, 11:58 AM
Unknown Object (File)
Sat, Dec 14, 10:18 AM
Unknown Object (File)
Thu, Dec 12, 10:41 PM
Unknown Object (File)
Thu, Dec 12, 10:41 PM
Subscribers
None

Details

Summary

Depends on D20287. Ref T5474. This hard-codes a storage value for every trigger, with a "Change status to <default closed status>" rule and two bogus rules. Rules may now apply transactions when cards are dropped.

Test Plan

Dragged cards to a column with a trigger, saw them close.

Diff Detail

Repository
rP Phabricator
Branch
trigger4
Lint
Lint Passed
SeverityLocationCodeMessage
Advicesrc/applications/project/storage/PhabricatorProjectTrigger.php:68XHP16TODO Comment
Unit
Tests Passed
Build Status
Buildable 22290
Build 30485: Run Core Tests
Build 30484: arc lint + arc unit

Event Timeline

amckinley added inline comments.
src/applications/project/exception/PhabricatorProjectTriggerCorruptionException.php
3–4

Why does this get its own class? Are we going to be catching it specifically somewhere?

src/applications/project/storage/PhabricatorProjectTrigger.php
69

Ok this was unclear on my first pass through this, but in reality, $rule_specifications is going to be a JSON blob, right? Which this code is turning back into objects?

194–198

Shouldn't we have a way to expand this info?

src/applications/project/trigger/PhabricatorProjectTriggerInvalidRule.php
10

Maybe add a "valid values for rules of this type are..." blurb?

src/applications/project/trigger/PhabricatorProjectTriggerRule.php
36–38

Shouldn't $this->getRecord()->getType() also be exposed? Or is that only used for construction of the rules and we won't need it again?

src/applications/project/trigger/PhabricatorProjectTriggerRuleRecord.php
8

Unused field.

src/applications/project/trigger/PhabricatorProjectTriggerStatusRule.php
3

Shouldn't this be PhabricatorProjectTriggerManiphestStatusRule? I know that Maniphest is the only application that has workboards and could therefore have columns and triggers, but wasn't it somewhere in the planning docs that we want to keep this appropriately generalizable?

This revision is now accepted and ready to land.Mar 18 2019, 7:39 PM
src/applications/project/exception/PhabricatorProjectTriggerCorruptionException.php
3–4

Yeah, I'm planning to eventually catch it on the trigger edit page and say "this trigger is garbo, you can edit if you want but you're going to overwrite the old stuff if you do."

src/applications/project/storage/PhabricatorProjectTrigger.php
69

Right, this is simulating a value coming out of the DB. In the future, this will just be $rule_specifications = $this->getRuleset(). I just haven't written a way to write to that property yet, since it involves a bunch of JS.

194–198

You can click "View Rule" to get everything (well, in a future diff). This is just a little tooltip that appears if you hover over the trigger icon on the workboard.

src/applications/project/trigger/PhabricatorProjectTriggerInvalidRule.php
10

This is currently only used in the tooltip, so I didn't want to get a paragraph of text in. When the edit part happens, that should get more details.

(This is going to have a Herald-style visual editor eventually, so it should be hard for users to specify invalid values -- really just extension/upgrade/manually-edit-the-db stuff.)

src/applications/project/trigger/PhabricatorProjectTriggerRule.php
36–38

Maybe, we just don't need it for anything right now. (Today, getValue() is only really for building transactions, and rules generally don't need to know their type to build transactions since the type is implicit in whichever class the method lives in.)

Normally, $this->getTriggerType() and $this->getRecord()->getType() will be the same. The only case where they differ is "Unknown" rules, where the getTriggerType() is "unknown" but the record type is the underlying storage record type ("some-extension-type" or whatever).

src/applications/project/trigger/PhabricatorProjectTriggerStatusRule.php
3

Yeah, this is probably a good idea. I'm sort of unsure we'll ever actually generalize, but no reason to make it harder than needbe.

  • Remove unused property.
  • Rename "status" to be specific to Maniphest, just in case.
This revision was automatically updated to reflect the committed changes.