vikunja/pkg/models
kolaente 0cd25f47e5
fix: populate complete entity data in deletion event webhooks (#2135)
Fixes webhook payloads for deletion events that were previously
containing incomplete or empty entity data. This occurred because
entities were being deleted from the database before the webhook event
was dispatched.

## Changes

This PR implements four targeted fixes to ensure complete entity data in
deletion event webhooks:

### 1. TaskAssignee Deletion (`pkg/models/listeners.go`)
- Extended `reloadEventData()` to fetch full assignee user data by ID
- Webhook payload now includes complete user object (username, email,
timestamps, etc.)

### 2. TaskComment Deletion (`pkg/models/task_comments.go`)
- Modified `Delete()` to call `ReadOne()` before deletion
- Ensures comment text, author, and timestamps are included in webhook
payload
- Follows the same pattern used by `Task.Delete()` and
`TaskAttachment.Delete()`

### 3. TaskAttachment Deletion (`pkg/models/task_attachment.go`)
- Extended `ReadOne()` to fetch the `CreatedBy` user
- Webhook payload now includes file creator information

### 4. TaskRelation Deletion (`pkg/models/task_relation.go`)
- Modified `Delete()` to fetch complete relation including `CreatedBy`
user before deletion
- Webhook payload now includes relation timestamps and creator
information

Fixes #2125
2026-01-24 12:50:18 +01:00
..
api_routes.go feat!: rename right to permission (#1277) 2025-08-13 11:05:05 +02:00
api_tokens.go feat!: rename right to permission (#1277) 2025-08-13 11:05:05 +02:00
api_tokens_permissions.go feat!: rename right to permission (#1277) 2025-08-13 11:05:05 +02:00
api_tokens_test.go fix: correct license header references (#882) 2025-06-10 12:18:38 +02:00
bulk_task.go feat: share logic for bulk update (#1456) 2025-09-10 16:40:59 +00:00
bulk_task_test.go chore(deps): update golangci-lint to 2.6.0 (#1737) 2025-10-31 17:28:52 +00:00
error.go refactor: centralize HTTP error handling (#2062) 2026-01-08 10:02:59 +00:00
events.go fix: cleanup team memberships, assignments and subscriptions when users lose access to a project 2025-10-09 13:33:27 +02:00
export.go fix(export): use os-level temp file to create user data export 2026-01-08 10:37:51 +01:00
favorites.go fix: correct license header references (#882) 2025-06-10 12:18:38 +02:00
kanban.go feat!: rename right to permission (#1277) 2025-08-13 11:05:05 +02:00
kanban_permissions.go feat!: rename right to permission (#1277) 2025-08-13 11:05:05 +02:00
kanban_task_bucket.go fix(events): only trigger task.updated once when marking task done 2025-11-16 11:01:15 +01:00
kanban_task_bucket_test.go fix(kanban): repeating tasks dates won't update when moved in done bucket (#1638) 2025-11-14 16:57:53 +00:00
kanban_test.go feat!: rename right to permission (#1277) 2025-08-13 11:05:05 +02:00
label.go feat!: rename right to permission (#1277) 2025-08-13 11:05:05 +02:00
label_permissions.go feat!: rename right to permission (#1277) 2025-08-13 11:05:05 +02:00
label_task.go feat!: rename right to permission (#1277) 2025-08-13 11:05:05 +02:00
label_task_permissions.go feat!: rename right to permission (#1277) 2025-08-13 11:05:05 +02:00
label_task_test.go feat!: rename right to permission (#1277) 2025-08-13 11:05:05 +02:00
label_test.go feat!: rename right to permission (#1277) 2025-08-13 11:05:05 +02:00
link_sharing.go fix(auth): fail when link share token is not parsable 2025-08-14 17:11:57 +02:00
link_sharing_permissions.go feat!: rename right to permission (#1277) 2025-08-13 11:05:05 +02:00
link_sharing_test.go feat!: rename right to permission (#1277) 2025-08-13 11:05:05 +02:00
listeners.go fix: populate complete entity data in deletion event webhooks (#2135) 2026-01-24 12:50:18 +01:00
main_test.go feat: move to slog for logging 2025-07-21 18:15:39 +02:00
mentions.go feat: format user mentions with display names in email notifications (#1930) 2025-12-10 12:39:05 +01:00
mentions_test.go feat: format user mentions with display names in email notifications (#1930) 2025-12-10 12:39:05 +01:00
message.go fix: correct license header references (#882) 2025-06-10 12:18:38 +02:00
models.go feat: task unread tracking (#1857) 2025-11-27 15:14:42 +01:00
notifications.go feat: format user mentions with display names in email notifications (#1930) 2025-12-10 12:39:05 +01:00
notifications_database.go feat!: rename right to permission (#1277) 2025-08-13 11:05:05 +02:00
notifications_test.go feat: add thread IDs to task notification emails for client-side threading (#1826) 2025-11-15 18:58:32 +01:00
permissions.go feat!: rename right to permission (#1277) 2025-08-13 11:05:05 +02:00
project.go fix(filters): preserve IsFavorite for saved filters in ReadOne (#2031) 2026-01-06 15:17:17 +00:00
project_duplicate.go fix: clear error when duplicating project with uploaded background (#1926) 2025-12-04 10:16:16 +01:00
project_duplicate_test.go fix: clear error when duplicating project with uploaded background (#1926) 2025-12-04 10:16:16 +01:00
project_permissions.go fix(sharing): use the highest team sharing permission when sharing the same project with multiple teams (#1894) 2025-11-27 22:25:06 +01:00
project_permissions_multiple_teams_test.go fix(sharing): use the highest team sharing permission when sharing the same project with multiple teams (#1894) 2025-11-27 22:25:06 +01:00
project_team.go feat!: rename right to permission (#1277) 2025-08-13 11:05:05 +02:00
project_team_permissions.go feat!: rename right to permission (#1277) 2025-08-13 11:05:05 +02:00
project_team_test.go feat!: rename right to permission (#1277) 2025-08-13 11:05:05 +02:00
project_test.go fix: correct license header references (#882) 2025-06-10 12:18:38 +02:00
project_users.go feat!: rename right to permission (#1277) 2025-08-13 11:05:05 +02:00
project_users_permissions.go feat!: rename right to permission (#1277) 2025-08-13 11:05:05 +02:00
project_users_permissions_test.go feat!: rename right to permission (#1277) 2025-08-13 11:05:05 +02:00
project_users_test.go feat!: rename right to permission (#1277) 2025-08-13 11:05:05 +02:00
project_view.go feat!: rename right to permission (#1277) 2025-08-13 11:05:05 +02:00
project_view_permissions.go feat!: rename right to permission (#1277) 2025-08-13 11:05:05 +02:00
reaction.go feat!: rename right to permission (#1277) 2025-08-13 11:05:05 +02:00
reaction_permissions.go feat!: rename right to permission (#1277) 2025-08-13 11:05:05 +02:00
reaction_test.go fix: correct license header references (#882) 2025-06-10 12:18:38 +02:00
saved_filter_positions_test.go fix(filters): ensure saved filter views never have position=0 (#1996) 2025-12-16 22:13:40 +00:00
saved_filters.go feat(filters): add UI for marking saved filters as favorites (#2055) 2026-01-07 16:21:41 +00:00
saved_filters_permissions.go feat!: rename right to permission (#1277) 2025-08-13 11:05:05 +02:00
saved_filters_test.go feat!: rename right to permission (#1277) 2025-08-13 11:05:05 +02:00
setup_tests.go feat(tasks): add support for ParadeDB when searching tasks 2025-07-18 23:18:04 +02:00
subscription.go feat!: rename right to permission (#1277) 2025-08-13 11:05:05 +02:00
subscription_permissions.go feat!: rename right to permission (#1277) 2025-08-13 11:05:05 +02:00
subscription_test.go feat!: rename right to permission (#1277) 2025-08-13 11:05:05 +02:00
task_assignees.go feat!: rename right to permission (#1277) 2025-08-13 11:05:05 +02:00
task_assignees_permissions.go feat!: rename right to permission (#1277) 2025-08-13 11:05:05 +02:00
task_attachment.go fix: populate complete entity data in deletion event webhooks (#2135) 2026-01-24 12:50:18 +01:00
task_attachment_permissions.go feat!: rename right to permission (#1277) 2025-08-13 11:05:05 +02:00
task_attachment_test.go feat!: rename right to permission (#1277) 2025-08-13 11:05:05 +02:00
task_collection.go feat: task unread tracking (#1857) 2025-11-27 15:14:42 +01:00
task_collection_filter.go fix(filter): ensure year is always within mysql allowed range 2026-01-09 23:11:22 +01:00
task_collection_filter_test.go fix(filters): support project filter in parentheses (#1647) 2025-10-13 11:10:22 +02:00
task_collection_sort.go fix: correct license header references (#882) 2025-06-10 12:18:38 +02:00
task_collection_sort_test.go fix: correct license header references (#882) 2025-06-10 12:18:38 +02:00
task_collection_test.go fix(kanban): repeating tasks dates won't update when moved in done bucket (#1638) 2025-11-14 16:57:53 +00:00
task_comment_permissions.go fix(sharing): make editing link share comments work 2025-10-09 10:53:18 +02:00
task_comments.go fix: populate complete entity data in deletion event webhooks (#2135) 2026-01-24 12:50:18 +01:00
task_comments_test.go feat: task unread tracking (#1857) 2025-11-27 15:14:42 +01:00
task_overdue_reminder.go fix: correct license header references (#882) 2025-06-10 12:18:38 +02:00
task_overdue_reminder_test.go fix(tasks): make sure all users get overdue reminder mails (#1901) 2025-11-28 11:06:47 +01:00
task_position.go fix(positions): detect and repair duplicate task positions automatically (#1998) 2025-12-20 19:38:28 +01:00
task_position_test.go fix(positions): detect and repair duplicate task positions automatically (#1998) 2025-12-20 19:38:28 +01:00
task_relation.go fix: populate complete entity data in deletion event webhooks (#2135) 2026-01-24 12:50:18 +01:00
task_relation_permissions.go feat!: rename right to permission (#1277) 2025-08-13 11:05:05 +02:00
task_relation_test.go feat!: rename right to permission (#1277) 2025-08-13 11:05:05 +02:00
task_reminder.go fix(reminders): only send reminders to active users 2025-12-10 10:56:19 +01:00
task_reminder_test.go fix(reminders): refactor and check permissions when fetching task users 2025-10-09 13:33:27 +02:00
task_search.go feat(tasks): add support for ParadeDB when searching tasks 2025-07-18 23:18:04 +02:00
task_search_bench_test.go fix: adjust benchmark so that it only checks the task fetching 2025-07-18 23:18:04 +02:00
task_search_test.go fix(kanban): make bucket query fixed per-view (#1007) 2025-06-25 11:38:24 +00:00
task_unread_statuses.go feat: task unread tracking (#1857) 2025-11-27 15:14:42 +01:00
tasks.go fix(filters): ensure saved filter views never have position=0 (#1996) 2025-12-16 22:13:40 +00:00
tasks_permissions.go feat!: rename right to permission (#1277) 2025-08-13 11:05:05 +02:00
tasks_test.go fix(events): only trigger task.updated once when marking task done 2025-11-16 11:01:15 +01:00
team_members.go fix: cleanup team memberships, assignments and subscriptions when users lose access to a project 2025-10-09 13:33:27 +02:00
team_members_permissions.go feat!: rename right to permission (#1277) 2025-08-13 11:05:05 +02:00
team_members_test.go fix: cleanup team memberships, assignments and subscriptions when users lose access to a project 2025-10-09 13:33:27 +02:00
team_sync.go fix: correct license header references (#882) 2025-06-10 12:18:38 +02:00
teams.go fix: cleanup team memberships, assignments and subscriptions when users lose access to a project 2025-10-09 13:33:27 +02:00
teams_permissions.go feat!: rename right to permission (#1277) 2025-08-13 11:05:05 +02:00
teams_permissions_test.go feat!: rename right to permission (#1277) 2025-08-13 11:05:05 +02:00
teams_test.go feat!: rename right to permission (#1277) 2025-08-13 11:05:05 +02:00
typesense.go fix: correct license header references (#882) 2025-06-10 12:18:38 +02:00
unsplash.go fix: correct license header references (#882) 2025-06-10 12:18:38 +02:00
user_delete.go fix: cleanup team memberships, assignments and subscriptions when users lose access to a project 2025-10-09 13:33:27 +02:00
user_delete_test.go fix: cleanup team memberships, assignments and subscriptions when users lose access to a project 2025-10-09 13:33:27 +02:00
user_project.go feat!: rename right to permission (#1277) 2025-08-13 11:05:05 +02:00
user_project_test.go feat: show user export status in settings (#1200) 2025-07-30 15:50:26 +00:00
users.go fix: correct license header references (#882) 2025-06-10 12:18:38 +02:00
webhooks.go feat!: rename right to permission (#1277) 2025-08-13 11:05:05 +02:00
webhooks_permissions.go feat!: rename right to permission (#1277) 2025-08-13 11:05:05 +02:00