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 execute method, to extract: that's what it actually does. This new extract method cannot execute anything, it just collects the information in a hash.

  • We extend the dsl so we can mark a command that will have side effects, the quick actions marked with this will be ignored in the extract method.

  • We add a new execute method, this collects the results from perform but also executes all commands marked to have side effects I think we could then figure out a way to test if the perform method tried to change anything.