After importing a wizard with a non-standard ID, the Wizard will be added to the Wizard Manager, however fails destruction with "No template found"

Environment

Discourse Version: v3.1.0.beta8 +346

Plugin Commit: fee56c2d

Steps to Reproduce

  1. Create a Wizard normally
  2. Go to the Wizard Manager and select the new Wizard.
  3. Export the newly created Wizard and open the resulting .json in an editor.
  4. Change the ID to any non-compliant ID that contains capitalized letters or hypens such as “PublicDisclosure” or “public-disclosure”. Save the .json.
  5. Select the wizards.json and import it via the Wizard Manager.
  6. Select the Destroy checkbox for the imported wizard and select the Destroy button.
  7. Destruction will fail with “no template found”

Example

Unable to provide a live example as the bug occurs in Admin only areas of the plugin.

Attempts to navigate to the public form does not work either.

Logs

There are no relevant logs that pertain to this issue

1 Like

Thank you for reporting this.

Can you please elaborate under which circumstances one would need to do this?

This was more of an accidental discovery when we attempted to rename a Wizard and generate a new URL for it.

As we didn’t want to manually re-create the Wizard from scratch, we exported the Wizard and edited the ID to attempt to facilitate this.

For a bit of further elaboration, the wizard appears in the Manager tab, however attempting to export it will result in {"failed":"FAILED","error":"No valid wizards selected"} being returned.

Likewise with destroying, it will give the error originally stated in the OP.

Additionally, this actually results in the Wizard remaining in the Manager section of the plugin, unable to be interacted with.

I’ve also encountered this issue, for exactly the same use-case: attempting to set a different URL for an existing Wizard.

The other use-case is to duplicate a Wizard as a shortcut to developing a new one which shares similar functionality.

The Custom Wizard Plugin doesn’t provide either of these functions in the UI, but it would be very helpful if it did.

Likewise, it would also be helpful if a non-compliant ID was captured when attempting to import the .json so that a corrupt Wizard never makes it into the database. I’m no dev, but I’m guessing that this would be easier to implement.

If you’d like to remove the corrupt Wizard from your instance, you can do so via the Rails console (be careful):

PluginStoreRow.where(plugin_name: 'custom_wizard',key: '=faultyID=').destroy_all
3 Likes