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

  1. Create a new user
  2. Create a lot of content with the user (some events, posts, groups)
  3. Ensure cron has run
  4. Delete the user through the command line using drush php-eval '\Drupal\user\Entity\User::load(10)->delete();' replacing 10 with the ID of your user
  5. 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

  1. Reproduce
  2. Create fix
    • Ensure the correct operator is used
    • Create an update hook
  3. Test
  4. Write release notes
  5. Review
  6. Commit

User interface changes

None expected

API changes

None expected

Data model changes

None expected

Comments

Kingdutch created an issue. See original summary.

tBKoT’s picture

ribel’s picture

Status: Needs review » Reviewed & tested by the community

LGTM

ribel’s picture

Merged and will be included in release 8.5

ronaldtebrake’s picture

Status: Reviewed & tested by the community » Fixed

  • ronaldtebrake committed 1483f20 on 8.x-8.x
    Issue #3162557 by ronaldtebrake, ribel: Ensure we allow batch size to be...
  • ribel committed 335ab46 on 8.x-8.x authored by tBKoT
    Issue #3162557 by tBKoT, Kingdutch: Update delete notification condition...
  • ronaldtebrake committed 457935f on 8.x-8.x authored by ribel
    Issue #3162557: Increase number of activities per one batch operation
    

  • ribel committed 0c126a4 on 8.x-9.x authored by tBKoT
    Issue #3162557 by tBKoT, Kingdutch: Update delete notification condition...
  • ronaldtebrake committed 54388e3 on 8.x-9.x
    Issue #3162557 by ronaldtebrake, ribel: Ensure we allow batch size to be...
  • ronaldtebrake committed b66da17 on 8.x-9.x authored by ribel
    Issue #3162557: Increase number of activities per one batch operation
    

Status: Fixed » Closed (fixed)

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