I accidentally created multiple messages with the same heartbeat id.

I'm trying to delete them, I click the delete button. The drupal message response says "Message deleted", but it's clearly still there. Deletion is not working.

Thanks!

CommentFileSizeAuthor
#5 heartbeat-fix-delete-procedure-725192.patch969 bytesmstef
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Stalski’s picture

Assigned: Unassigned » Stalski
Status: Active » Fixed

I fixed this and refactored that part.

Stalski’s picture

Status: Fixed » Closed (fixed)
mstef’s picture

Priority: Normal » Major
Status: Closed (fixed) » Active

Using code in 4.x-dev as of today, I still cannot delete items. I get the confirmation form, then the success message, but the message remains.

mstef’s picture

Problem seems to stem from heartbeat_get_uaids(), which is called from within _heartbeat_activity_delete(). I have locale installed, and it seems that extra query is returning empty.

mstef’s picture

Status: Active » Needs review
FileSize
969 bytes

Yes, that was the issue. If locale is installed, not only should it add the extra translated message, but the code forgets to also add the original message.

I also changed the delete confirm form component that stores the uaid. It was set to be #type hidden, where it should be #type value.

Patch attached.

Stalski’s picture

I saw a caveat in the calculation of uaids. When no translations were logged (for what reason ever), the default activity id is still preserverd now.
Pushed to git. I hope this fixes it.

Stalski’s picture

Well I was thinking of doing it like you did or with array_unique ... does not matter much here.
I am checking the value statement in the patch. What is the specific reason for this?

mstef’s picture

Using value is more secure than hidden. With hidden, the actual data is available in the HTML source, and there's no reason for it to be. Another way of doing this is how node forms work, by just doing something like: $form['#uaid'] = $uaid. Then in the submit handle, don't check $form_state, just check $form['#uaid'] - keep it out of the source and POST data.

Stalski’s picture

Ok, pushed