Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When I add a heartbeat comment to an activity that was created with the shoutbox the comment disappears after some time (about 24 hours one day) it is also deleted from the database table. I cannot figure out when exactly the comment gets removed from the table and why.
Is there any configuration which causes comments to be deleted after a given time? Does the standard cron job do anything on the heartbeat comments table?
Thanks in advance for your support
Comments
Comment #1
Stalski CreditAttribution: Stalski commentedComments are actually only deleted when the parent activity message (or in node context, the node) gets deleted.
The cronjob will delete too old activity (and their comments attached).
So I don't know of any case where comments would be deleted with the parent activity being deleted. Not sure what could cause this behavior.
Comment #2
goekhanc CreditAttribution: goekhanc commentedDo you have any hint, how I can trace what causes this problem?
I am trying to analyze mysql.log but cannot find where the comments are removed.
Comment #3
Stalski CreditAttribution: Stalski commentedThe best solution to find the problem is to see inside the comment delete function (I do hope you mean node comments) and do a ddebugbactrace or debug_backtrace if you don't have devel installed.
Comment #4
goekhanc CreditAttribution: goekhanc commented"Enable node comments for this activity template if a node is available " is not enabled. all acitivty comments are not node comments. even though the activity is "node creation". the comments are stored in the heartbeat_comments.
Comment #5
Stalski CreditAttribution: Stalski commentedok, then you'll need to backtrace in the heartbeat comment delete function
Comment #6
goekhanc CreditAttribution: goekhanc commentedI noticed, that activity comments get removed, after I remove an activity. I dont mean, that the related comment disappears, but all activity comments disappear.
Maybe these lines in the mysql.log cause this???
Comment #7
goekhanc CreditAttribution: goekhanc commentedI commented the comments delete function, which is called after an activity has been deleted. The acitivity comments are not removed after one activity is deleted. But now every comments will be kept in the table, even though the corresponding activity is deleted.
It seems to me that there is a problem with the $uaids variable. But I dont know how to solve this problem.
my change in heartbeat_comments.module
Comment #8
Stalski CreditAttribution: Stalski commentedThis is indeed the error, this should not happen.
So in detail:
This was the function and this is how it is now:
So this will fix the problem. I used where and it should be condition. In all other places, I used it correct, stupid :(
So thanks for the report and the fix has been pushed to git.
Comment #9
Stalski CreditAttribution: Stalski commented