DEV: Allow plugins to add wizard steps after specific steps (PR #9315)

GitHub

I am not a big fan of using hard coded index values. Imagine if multiple plugins here are adding steps, all the indexes will be different!

Also, the builder already exposes an event that emits the current @wizard so I think we could piggy back that. For example:

DiscourseEvent.on(:build_wizard) do |wizard|
  wizard.append_step('more-contact-stuff', after: 'forum-title') do |step|
     # step config
  end
end

I think a new API that looks like the above is better because it uses the string id of the step it wants to append after. It will always put this step after forum-title, regardless of indices.

@eviltrout Yeah that works as well!

The title of this pull request changed from “DEV: Allow plugins to add custom wizard steps with indices” to "DEV: Allow plugins to add wizard steps after specific steps

not to gold plate it, but we could do something simpler here right:

step.index += 1 while (step = step.next)

Gold plating in this case is much better than whatever the hell you would call what I had.