Ref T13269. This is mostly copying code from the similar Herald implementation. Note that the drop effect preview always renders because we don't have the infrastructure to compare lists of edge targets.
- Maniphest Tasks
- T13269: Improve initial implementations of Workboard triggers and groups
- rP8b475898ee92: Add trigger rule for adding projects to a task
Created some triggers, dragged some tasks around, checked that tasks that already had project membership didn't write additional edges.
Note that the drop effect preview always renders because we don't have the infrastructure to compare lists of edge targets.
Oh, perfect -- yeah, this seems like a totally reasonable starting point to me per discussion elsewhere.
This (and the corresponding "remove" rule) will get us into a couple weird situations:
- If you add a milestone or subproject of the current project, the card will teleport out of the current project and into the milestone/subproject.
- If you remove the current project, the card will teleport off the board.
In both cases, I think "teleport" currently means "card stays visible, but vanishes on reload".
In both cases, I think this will probably be reasonably obvious what you're doing most of the time, and it's sort of legitimate if you want to make like an "Take it Out Behind the Shed" column that plays a sound and removes the current project or something. We could maybe warn/refine these cases later ("This trigger sends cards to the shadow realm, which is a legal operation, but just a heads up in case you didn't mean to do that.")
I think you should be able to drop this logic and just apply the transaction unconditionally -- the Editor later on will do the right thing in terms of reducing or mooting the transaction. We might need a setContinueOnNoEffect(true) somewhere, but the TriggerRule shouldn't need to care about the current state of the object.