]> BookStack Code Mirror - bookstack/commit
Watching: Prevent issues when watchable or user is deleted
authorDan Brown <redacted>
Sun, 3 Sep 2023 13:19:43 +0000 (14:19 +0100)
committerDan Brown <redacted>
Sun, 3 Sep 2023 13:19:43 +0000 (14:19 +0100)
commit817581aa0c8f7575f06d033fe7ec5e19744bee3c
tree92d68816ed231716cf0b628a84ef338f5a8568fa
parent1cd19c76ba91141c8d1877b8a7c1c58d008d9fb3
Watching: Prevent issues when watchable or user is deleted

- Adds filtering to the watched items list in notification preferences
  so that deleted (recycle bin) items are removed via query.
- Adds relations and logic to properly remove watches upon user and
  entity delete events, to old watches in database do not linger.
- Adds testing to cover the above.

Did not add migration for existing data, since patch will be close to
introduction, and lingering DB entries don't open a security concern,
just some potential confusion in specific potential scenarios.
Probably not work extra migration risk, although could add in future if
concerns/issues are found.

Related to #4499
app/Entities/EntityProvider.php
app/Entities/Models/Entity.php
app/Entities/Tools/TrashCan.php
app/Permissions/PermissionApplicator.php
app/Users/Controllers/UserPreferencesController.php
app/Users/Models/User.php
app/Users/UserRepo.php
tests/Activity/WatchTest.php
tests/Helpers/EntityProvider.php
tests/User/UserPreferencesTest.php