updating privacy options triggered from contact change causes infinite loop
We had a client create a rule like the following:
- triggered on any contact changed
- action: update privacy settings (there was a condition as well, but I don't think it's relevant)
This caused an infinite loop. The problem is that the "any contact changed" is triggered off the post hook, and updating privacy settings uses the contact api -- which in turn triggers the post hook. So it gets stuck in a loop.
We fixed it temporarily by rewriting the privacy action to use straight SQL instead of the api. But I have to believe you've run into this problem before, as this kind of loop could easily happen with other trigger/action combinations. If you think straight SQL is the best solution, we can provide a PR. If you have fixed this in other cases in a different way, point me in the right direction and we'll investigate and work on a better solution.