[PR #1620] [MERGED] fix(sharing): ensure unassigned users don't get notifications #5088

Closed
opened 2026-04-16 13:25:57 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/go-vikunja/vikunja/pull/1620
Author: @kolaente
Created: 10/8/2025
Status: Merged
Merged: 10/9/2025
Merged by: @kolaente

Base: mainHead: codex/fix-overdue-notifications-for-deleted-users


📝 Commits (2)

  • ca9c65a fix: cleanup team memberships, assignments and subscriptions when users lose access to a project
  • f2bd2ff fix(reminders): refactor and check permissions when fetching task users

📊 Changes

10 files changed (+631 additions, -37 deletions)

View changed files

📝 pkg/models/events.go (+12 -0)
📝 pkg/models/listeners.go (+38 -0)
📝 pkg/models/task_overdue_reminder_test.go (+19 -1)
📝 pkg/models/task_reminder.go (+115 -34)
📝 pkg/models/task_reminder_test.go (+219 -0)
📝 pkg/models/team_members.go (+16 -2)
📝 pkg/models/team_members_test.go (+87 -0)
📝 pkg/models/teams.go (+70 -0)
📝 pkg/models/user_delete.go (+21 -0)
📝 pkg/models/user_delete_test.go (+34 -0)

📄 Description

Resolves https://github.com/go-vikunja/vikunja/issues/1581

This pull request introduces a robust mechanism to automatically clean up task assignments and subscriptions when a user is removed from a team, as well as improvements to permission filtering for task-user associations. It adds new event-driven cleanup logic, updates related listeners, and extends test coverage to ensure data consistency and correct permission enforcement.

Automatic cleanup on team member removal:

  • Introduced a new TeamMemberRemovedEvent and corresponding event listener (CleanupTaskAssignmentsAfterTeamRemoval) that triggers cleanup of task assignments and subscriptions when a user loses access to projects via team removal. [1]], [2]], [3]], [4]])
  • Modified the TeamMember.Delete method to dispatch the new removal event after deleting a team member. [1]], [2]])

Permission filtering and data integrity:

  • Refactored getTaskUsersForTasks to enforce permission checks and prevent users without access from being returned as task users, ensuring correct filtering after team membership changes. [1]], [2]], [3]])
  • Added and improved tests to verify cleanup of task assignments and subscriptions after team member removal and project deletion, as well as permission-based filtering of task users. [1]], [2]], [3]])

General user deletion improvements:

  • Enhanced the user deletion process to remove all task assignments, subscriptions, and team memberships associated with the user, and added tests to verify this cleanup. [1]], [2]])

https://chatgpt.com/codex/tasks/task_e_68e689811c508322a701f1cb9c633257


🔄 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/1620 **Author:** [@kolaente](https://github.com/kolaente) **Created:** 10/8/2025 **Status:** ✅ Merged **Merged:** 10/9/2025 **Merged by:** [@kolaente](https://github.com/kolaente) **Base:** `main` ← **Head:** `codex/fix-overdue-notifications-for-deleted-users` --- ### 📝 Commits (2) - [`ca9c65a`](https://github.com/go-vikunja/vikunja/commit/ca9c65ad49eab062d276fa47afb73039a164aca2) fix: cleanup team memberships, assignments and subscriptions when users lose access to a project - [`f2bd2ff`](https://github.com/go-vikunja/vikunja/commit/f2bd2ffcd75f310e43960e976cb21dfeb15d2635) fix(reminders): refactor and check permissions when fetching task users ### 📊 Changes **10 files changed** (+631 additions, -37 deletions) <details> <summary>View changed files</summary> 📝 `pkg/models/events.go` (+12 -0) 📝 `pkg/models/listeners.go` (+38 -0) 📝 `pkg/models/task_overdue_reminder_test.go` (+19 -1) 📝 `pkg/models/task_reminder.go` (+115 -34) 📝 `pkg/models/task_reminder_test.go` (+219 -0) 📝 `pkg/models/team_members.go` (+16 -2) 📝 `pkg/models/team_members_test.go` (+87 -0) 📝 `pkg/models/teams.go` (+70 -0) 📝 `pkg/models/user_delete.go` (+21 -0) 📝 `pkg/models/user_delete_test.go` (+34 -0) </details> ### 📄 Description Resolves https://github.com/go-vikunja/vikunja/issues/1581 This pull request introduces a robust mechanism to automatically clean up task assignments and subscriptions when a user is removed from a team, as well as improvements to permission filtering for task-user associations. It adds new event-driven cleanup logic, updates related listeners, and extends test coverage to ensure data consistency and correct permission enforcement. **Automatic cleanup on team member removal:** * Introduced a new `TeamMemberRemovedEvent` and corresponding event listener (`CleanupTaskAssignmentsAfterTeamRemoval`) that triggers cleanup of task assignments and subscriptions when a user loses access to projects via team removal. [[1]](diffhunk://#diff-8430b0f58da1cbe15deac7e09bb4acaa1b1e3f2e8772d883a7df24ef6173fa2bR260-R271)], [[2]](diffhunk://#diff-ad921e82fbd1e9e43b99e0358823f740635eb57df9708b7557c7bae59c89025dR56)], [[3]](diffhunk://#diff-ad921e82fbd1e9e43b99e0358823f740635eb57df9708b7557c7bae59c89025dR1041-R1061)], [[4]](diffhunk://#diff-e54c82973b257e815700761c9f4dfb5642d32848120f056da88f545546cddee6R1-R109)]) * Modified the `TeamMember.Delete` method to dispatch the new removal event after deleting a team member. [[1]](diffhunk://#diff-f0e037b76180467423bb0ea8f1bb57f9a7cd7c5ba38a44fc91f606594c73c706L91-R91)], [[2]](diffhunk://#diff-f0e037b76180467423bb0ea8f1bb57f9a7cd7c5ba38a44fc91f606594c73c706L118-R127)]) **Permission filtering and data integrity:** * Refactored `getTaskUsersForTasks` to enforce permission checks and prevent users without access from being returned as task users, ensuring correct filtering after team membership changes. [[1]](diffhunk://#diff-96c26d964d5c625f031aa4a74068842dd1a93784e0ee68537e9968bfae04993dL76-R163)], [[2]](diffhunk://#diff-96c26d964d5c625f031aa4a74068842dd1a93784e0ee68537e9968bfae04993dL137-R189)], [[3]](diffhunk://#diff-96c26d964d5c625f031aa4a74068842dd1a93784e0ee68537e9968bfae04993dL151-R200)]) * Added and improved tests to verify cleanup of task assignments and subscriptions after team member removal and project deletion, as well as permission-based filtering of task users. [[1]](diffhunk://#diff-60b4ce880890549fc8880fa67f73fe6dba8ead5890e1fb718b551ec0ff879b78R26)], [[2]](diffhunk://#diff-60b4ce880890549fc8880fa67f73fe6dba8ead5890e1fb718b551ec0ff879b78R78-R119)], [[3]](diffhunk://#diff-a8cee54feac7ac5381301cb8e30515f74838ec733acce2d94d78e96a5d0e1152R169-R267)]) **General user deletion improvements:** * Enhanced the user deletion process to remove all task assignments, subscriptions, and team memberships associated with the user, and added tests to verify this cleanup. [[1]](diffhunk://#diff-33127a36c47188177a8f1edd0cf50870991d56eed73dfbbded45b67e554aef53R152-R166)], [[2]](diffhunk://#diff-ca9f686b82b4b0e06c359c3db8cdf0e432b99c87bc43c79820750c9872f7a1c5R74-R107)]) These changes collectively ensure that when team membership or user access changes, related data is consistently and securely cleaned up to prevent orphaned records and unauthorized access. ------ https://chatgpt.com/codex/tasks/task_e_68e689811c508322a701f1cb9c633257 --- <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-16 13:25:57 -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#5088