[PR #2386] [MERGED] fix: send account deletion notification before deleting user row #8229

Closed
opened 2026-04-20 18:06:10 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/go-vikunja/vikunja/pull/2386
Author: @tink-bot
Created: 3/10/2026
Status: Merged
Merged: 3/10/2026
Merged by: @kolaente

Base: mainHead: fix/user-delete-cli


📝 Commits (1)

  • 547e376 fix: send account deletion notification before deleting user row

📊 Changes

1 file changed (+7 additions, -4 deletions)

View changed files

📝 pkg/models/user_delete.go (+7 -4)

📄 Description

Summary

  • Fixes CLI vikunja user delete <id> -n failing with User does not exist even though the user exists
  • Root cause: DeleteUser deleted the user row first, then called notifications.Notify, which internally calls User.ShouldNotify() — a method that queries the DB to check the user's status. Since the row was already deleted within the same transaction, it returned ErrUserDoesNotExist.
  • Fix: move the notification call before the DELETE statement so the user row still exists when ShouldNotify checks it

Closes #2335

Test plan

  • Run vikunja user delete <id> -n and confirm the user is deleted without error
  • Verify the account deletion notification is still sent

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/go-vikunja/vikunja/pull/2386 **Author:** [@tink-bot](https://github.com/tink-bot) **Created:** 3/10/2026 **Status:** ✅ Merged **Merged:** 3/10/2026 **Merged by:** [@kolaente](https://github.com/kolaente) **Base:** `main` ← **Head:** `fix/user-delete-cli` --- ### 📝 Commits (1) - [`547e376`](https://github.com/go-vikunja/vikunja/commit/547e3763430a9e147c480b662721ea67bdaeb7d9) fix: send account deletion notification before deleting user row ### 📊 Changes **1 file changed** (+7 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `pkg/models/user_delete.go` (+7 -4) </details> ### 📄 Description ## Summary - Fixes CLI `vikunja user delete <id> -n` failing with `User does not exist` even though the user exists - Root cause: `DeleteUser` deleted the user row first, then called `notifications.Notify`, which internally calls `User.ShouldNotify()` — a method that queries the DB to check the user's status. Since the row was already deleted within the same transaction, it returned `ErrUserDoesNotExist`. - Fix: move the notification call before the `DELETE` statement so the user row still exists when `ShouldNotify` checks it Closes #2335 ## Test plan - [ ] Run `vikunja user delete <id> -n` and confirm the user is deleted without error - [ ] Verify the account deletion notification is still sent --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-20 18:06:10 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/vikunja#8229