The shortcut_set_delete() function has code which is intended to prevent the sitewide default shortcut set from ever being deleted - however, I just realized this doesn't quite work correctly. Instead of checking the sitewide default, it actually checks the default for the current logged-in user, which might be different and which we do not actually want to prevent from being deleted (plus, checking things for the current logged-in user does not make sense in an API function).

One could also argue that an API function should not be preventing this deletion at all... however, unless you have another module installed which interacts with the shortcuts in a very particular way, deleting the sitewide default is pretty much guaranteed to break things. So for now, this patch leaves that feature in place.

CommentFileSizeAuthor
#1 shortcut-delete-default-set.patch790 bytesDavid_Rothstein

Comments

David_Rothstein’s picture

StatusFileSize
new790 bytes

Patch.

jhodgdon’s picture

Status: Needs review » Needs work

This will not fix the problem, because there is a hook in the shortcuts module that lets other modules select defaults for particular users. This will not prevent deleting those defaults.

I will fix this so it makes sense and works along with #647084: Missing shortcut edit and delete operations on shortcuts admin. It's needed in order to have the UI work...

David_Rothstein’s picture

Why should deleting the default for a particular user be forbidden? (The sitewide default is a fallback and needs to be there for that reason, but I don't see why it's a problem to delete any others.)

Anyway, let's see what you come up with for the other issue.

jhodgdon’s picture

I take it back: Your patch is fine. But I had to do some stuff with permissions on the other issue, because we were exposing a delete set link, so I put I think the same line in there.

jhodgdon’s picture

Status: Needs work » Fixed

This was fixed on that other issue.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.