Skip to content

feat: Delete chat messages and assignments when user is deleted#604

Merged
janepie merged 2 commits into
mainfrom
feat/user-delete-event
Jul 15, 2026
Merged

feat: Delete chat messages and assignments when user is deleted#604
janepie merged 2 commits into
mainfrom
feat/user-delete-event

Conversation

@janepie

@janepie janepie commented Jul 15, 2026

Copy link
Copy Markdown
Member

No description provided.

…top running assignments

Signed-off-by: Jana Peper <jana.peper@nextcloud.com>
@janepie

janepie commented Jul 15, 2026

Copy link
Copy Markdown
Member Author

/backport to stable34

$userId = $event->getUid();

try {
$this->assignmentsService->deleteAllForUser($userId);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't cleanup the jobs created by SessionSummaryService. I think we should check if there are some jobs scheduled for the user and remove them from the bg job queue.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pushed a new commit that does both.

throw new UnauthorizedException();
}
if ($this->userManager->get($userId) === null) {
$this->deleteAllForUser($userId);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also clean everything up here? The chat sessions+messages and the summary bg jobs?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean, they should already be cleaned up via listener, right?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If some users where deleted before this PR, there can still be data hanging around.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair, but maybe that should be a migration step and not solved here?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, a repair step seems appropriate.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A repair step makes sense for this.

@julien-nc

Copy link
Copy Markdown
Member

@lukasdotcom Wdyt of my review comments?

Signed-off-by: Lukas Schaefer <lukas@lschaefer.xyz>
@janepie janepie requested a review from julien-nc July 15, 2026 13:28

@julien-nc julien-nc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@janepie janepie merged commit 09546e1 into main Jul 15, 2026
10 of 11 checks passed
@janepie janepie deleted the feat/user-delete-event branch July 15, 2026 13:38
@backportbot

backportbot Bot commented Jul 15, 2026

Copy link
Copy Markdown

The backport to stable34 failed. Please do this backport manually.

# Switch to the target branch and update it
git checkout stable34
git pull origin stable34

# Create the new backport branch
git checkout -b backport/604/stable34

# Cherry pick the change from the commit sha1 of the change against the default branch
# This might cause conflicts, resolve them
git cherry-pick 8165fab7 72456875

# Push the cherry pick commit to the remote repository and open a pull request
git push origin backport/604/stable34

Error: Failed to check for changes with origin/stable34: No changes found in backport branch


Learn more about backports at https://docs.nextcloud.com/server/stable/go.php?to=developer-backports.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants