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.
Problem/Motivation
There is an error in \Drupal\activity_creator\ActivityNotifications::deleteNotificationsByIds
. On line 260 of ActivityNotifications.php
the line ->condition('aid', $activity_ids)
is used, where $activity_ids
is an array. However, the default comparison operator for condition
is =
which causes issues in the query, resulting in unremoved activities.
Steps to reproduce
- Create a new user
- Create a lot of content with the user (some events, posts, groups)
- Ensure cron has run
- Delete the user through the command line using
drush php-eval '\Drupal\user\Entity\User::load(10)->delete();'
replacing10
with the ID of your user - You should see SQL errors on the console regarding the removal
Proposed resolution
- Ensure the correct operator is used in
condition
, in this case add"IN"
as third argument. Similar to what's done on line 196 of the same file - Create an update hook that cleans up any notifications for whom the user or associated entity no longer exists.
Remaining tasks
- Reproduce
-
Create fix
- Ensure the correct operator is used
- Create an update hook
- Test
- Write release notes
- Review
- Commit
User interface changes
None expected
API changes
None expected
Data model changes
None expected
Comments
Comment #2
tBKoT CreditAttribution: tBKoT at Lemberg Solutions commentedhttps://github.com/goalgorilla/open_social/pull/1965
Comment #3
ribelLGTM
Comment #4
ribelMerged and will be included in release 8.5
Comment #5
ronaldtebrake CreditAttribution: ronaldtebrake as a volunteer and at Open Social for Open Social commented