-
Notifications
You must be signed in to change notification settings - Fork 119
Description
Expected: should be able to delete a question even if the template is published.
Actual: If template is published when you edit the question you never get a delete button.
To reproduce:
Create a template.
Publish it.
Edit it. Go to a question and choose "Edit" for that question.
The question changes to an editable form and at the bottom you have 2 buttons: "Edit" and "Cancel"
If you choose "Cancel" the question is removed from the screen but if you refresh it reappears.
Needs fixed and tested.
Notes:
Looking at the code, the critical bit is in
app/views/org_admin/questions/_form.html line 97 ish
where the buttons are drawn
<% if question.id.present? && !question.section.phase.template.published? %>
so the first clause is checking is it's been saved. If it has we present a Delete button and a Cancel, if not we just have a Cancel and only need to remove from the screen.
The second clause is the problem. If the template has been published we will never get the delete button and so never be able to delete the question. I think this might be a leftover from before versioning?? If we remove this clause then the delete button appears and the delete action triggers a deep copy of the template so I think we are all ok with this. So I think this was a protection from before versioning and can just be removed. Needs careful checking and UAT.