Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Problem/Motivation
During the Private Shortcut module development, I found that when an user account is deleted, its assigned shortcut set remains mapped in the shortcut_set_users table.
Steps to reproduce
In a fresh standard D9.4 installation:
- Create a new user account, their expected UID is 2
- Explicitly assign the default shortcut set at /user/2/shortcuts
- Remove the user account
The shortcut assignment will remain at the shortcut_set_users table:
> SELECT * FROM shortcut_set_users;
+-----+----------+
| uid | set_name |
+-----+----------+
| 2 | default |
+-----+----------+
Proposed resolution
Clean up assigned shortcut set when a user is deleted.
Remaining tasks
Patch, test, review.
User interface changes
None.
API changes
N/A
Data model changes
N/A
Release notes snippet
Not required.
Comment | File | Size | Author |
---|---|---|---|
#2 | 3262384-2.patch | 2.06 KB | manuel.adan |
#2 | 3262384-2-TEST-ONLY-FAIL.patch | 1.2 KB | manuel.adan |
Comments
Comment #2
manuel.adanComment #3
manuel.adanComment #5
manuel.adanTest only patch failed as expected.
Comment #6
manuel.adanComment #7
manuel.adanI dare to move it as RTBC to gain attention since it is easy to review.
Comment #9
manuel.adanAgain TEST-ONLY-FAIL failed as expected. Fixed full patch/fail files weights.
Comment #10
catchThis makes sense. After this patch is committed, we'll still have the stale data in people's databases from before the bug was fixed. However, I think it's better to commit the fix to stop new bad data being created, and then have a follow-up to clean the old data up, so I've opened #3265660: Clean up stale shortcut set records for that. But, please don't set your own patches to RTBC - we only commit core issues with at least two, ideally three including the committer involved.
Also wondering if the test coverage should actually try to load the shortcut set we requested from the database, rather than checking whether the now-deleted user gets the default shortcut set.
Comment #11
larowlanLooks good to me
Comment #16
catchCommitted/pushed to 10.0.x, cherry-picked to 9.4.x and 9.3.x, thanks!