Hi, we're getting a bug in our Toolset-based app when a user deletes a post. We have a staging copy of the site set up so that we can test it without impacting the live production site, and I have been able to replicate the behavior. Here's a description of the bug we're encountering:
1) On the Current Aid Requests page (hidden link), the user with administrator-level permissions clicks the trash icon next to an aid request to delete it.
2) An alert dialog opens saying "Are you sure you want to delete this aid request? There is no undo." So far, so good.
3) On pressing OK, the same alert dialog appears again.
4) Pressing OK again, the same alert dialog appears a third time.
5) Pressing OK on the third dialog, a dialog opens saying "Are you sure you want to delete this person's user account?"
6) Pressing OK on that dialog, the deletion runs and the Aid Request is deleted.
So the delete action works, but the multiple dialogs are confusing and the question about deleting the user account scares the user (though so far we have not detected any user accounts actually getting deleted).
Here's a description of how it's built:
1) The trash can icon next to each Aid Request post listed on hidden link is a
[cred-delete-post action='trash' onsuccess='self' class=' delete-notice']
link. See the View named "List Aid Requests - NPS".
2) In the same View ("List Aid Requests - NPS"), in the JS Editor there's a javascript function that triggers the alert:
<pre>
//Alert notice
var btn = jQuery(".delete-notice");
btn.data("funcToCall", btn.attr("onclick"));
jQuery(".delete-notice").removeAttr("onclick");
jQuery(".delete-notice").bind("click", function(e){
if(confirm("Are you sure you want to delete this aid request? There is no undo.")){
var func = jQuery(this).data("funcToCall");
eval(func);
} else {
return false;
}
});
</pre>
This is obviously where the first alert dialog is being produced, but I'm not clear why it's getting triggered mulitple times.
Also, I'm not aware of any code that would produce the "Are you sure you want to delete this person's user account?" dialog, or why it's being triggered.
We'll provide you with admin access so that you can take a look. I've created three Aid Requests that you're welcome to delete to replicate the behavior (2026 - 7, 2026 - 8, and 2026 - 9), and you're welcome to add new requests as needed to test with.
It's probably worth noting that the Aid Request post is meant to have related Aid Items added to it, and I thought that the multiple dialogs might be related to those related child Aid Items posts getting deleted when the parent Aid Request post is deleted, but I got the same multiple dialogs even on an Aid Request post with no Aid Items added to it.
I'm hoping you can determine why this is happening and how to fix it! What we want is just the single Are You Sure alert, and then on pressing OK once, the deletion.
Thanks!
David