mirror of
https://github.com/discourse/discourse.git
synced 2025-02-21 13:17:13 +08:00

This is extracted from #22390. This patch adds a new `optional` option to the `model` step. This means if an optional model returns something blank (`nil` or an empty collection) then the service won’t fail and will execute the next step. However if a model is properly returned, the step will try to check if it is valid or not (if it responds to `#invalid?`). If the model isn’t valid, then the step will fail (so no change here).