Refactor the QuickActions::InterpretService to extract commands without side effects
Some quick actions have side effects (https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/22485#note_110876125 or approve). But it makes sense to be able to extract the commands that manipulate a record in order to validate them in one of the BuildServices.
I think we could implement that as follows:
-
We rename the current
executemethod, toextract: that's what it actually does. This newextractmethod cannot execute anything, it just collects the information in a hash. -
We extend the
dslso we can mark a command that will have side effects, the quick actions marked with this will be ignored in theextractmethod. -
We add a new
executemethod, this collects the results fromperformbut also executes all commands marked to have side effects I think we could then figure out a way to test if theperformmethod tried to change anything.