[PR #1826] [MERGED] feat: add thread IDs to task notification emails for client-side threading #7841

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

📋 Pull Request Information

Original PR: https://github.com/go-vikunja/vikunja/pull/1826
Author: @Copilot
Created: 11/15/2025
Status: Merged
Merged: 11/15/2025
Merged by: @kolaente

Base: mainHead: copilot/add-thread-id-to-mail-notifications


📝 Commits (7)

  • 8f2b2fa Initial plan
  • f90af54 feat: add thread ID to task notification emails for email threading
  • aadf68d Complete implementation and testing of thread ID for task notifications
  • 43e80be Merge branch 'main' into copilot/add-thread-id-to-mail-notifications
  • 6c3fd33 fix: use hostname
  • efe8dc6 fix lint
  • 4c0e32d feat: add tests for thread id

📊 Changes

8 files changed (+166 additions, -4 deletions)

View changed files

📝 go.sum (+0 -4)
📝 pkg/mail/send_mail.go (+6 -0)
📝 pkg/models/notifications.go (+44 -0)
pkg/models/notifications_test.go (+85 -0)
📝 pkg/notifications/mail.go (+7 -0)
📝 pkg/notifications/mail_render.go (+1 -0)
📝 pkg/notifications/mail_test.go (+15 -0)
📝 pkg/notifications/notification.go (+8 -0)

📄 Description

Task-related email notifications (comments, reminders, assignments, etc.) now include thread IDs to enable email client threading. All notifications for the same task share a common Message-ID format thread identifier.

Changes

Notification interface (pkg/notifications/notification.go)

  • Added ThreadID interface with ThreadID() string method
  • Updated notifyMail() to apply thread ID when notification implements the interface

Mail pipeline (pkg/notifications/mail.go, pkg/notifications/mail_render.go, pkg/mail/send_mail.go)

  • Added threadID field to Mail struct with setter method
  • Extended mail.Opts with ThreadID field
  • Modified getMessage() to set In-Reply-To and References headers

Task notifications (pkg/models/notifications.go)

  • Implemented ThreadID() for: ReminderDueNotification, TaskCommentNotification, TaskAssignedNotification, TaskDeletedNotification, UndoneTaskOverdueNotification, UserMentionedInTaskNotification
  • Thread ID format: <task-{id}@{domain}> where domain is extracted from ServicePublicURL config

Example

For task ID 123 on instance at https://vikunja.example.com:

Thread-ID: <task-123@vikunja.example.com>
In-Reply-To: <task-123@vikunja.example.com>
References: <task-123@vikunja.example.com>

All task notifications now thread correctly in Gmail, Outlook, Apple Mail, and other RFC 5322 compliant clients.

Original prompt

Every notification that's somehow belonging to a task (a comment, a reminder, a single overdue notification, an assignee notice) should have a thread id in the mail message. use the task id for that. For that, extend the message interface with a new method "ThreadID()" and pass it down to where the mail is actually put together and sent. You know how thread ids work for mails, look at the library used to figure out how to add it to the mail.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.


🔄 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/1826 **Author:** [@Copilot](https://github.com/apps/copilot-swe-agent) **Created:** 11/15/2025 **Status:** ✅ Merged **Merged:** 11/15/2025 **Merged by:** [@kolaente](https://github.com/kolaente) **Base:** `main` ← **Head:** `copilot/add-thread-id-to-mail-notifications` --- ### 📝 Commits (7) - [`8f2b2fa`](https://github.com/go-vikunja/vikunja/commit/8f2b2fa1e24aae77df771b5bc0ec15dc979e9654) Initial plan - [`f90af54`](https://github.com/go-vikunja/vikunja/commit/f90af5453e6f08dbb686e01aff9eae0e42fe2625) feat: add thread ID to task notification emails for email threading - [`aadf68d`](https://github.com/go-vikunja/vikunja/commit/aadf68dd4f4ed04fe4c4207b35a661fc3c3dd7e2) Complete implementation and testing of thread ID for task notifications - [`43e80be`](https://github.com/go-vikunja/vikunja/commit/43e80be0d9a24b7c186b7b73b5c04af00e3fb4c4) Merge branch 'main' into copilot/add-thread-id-to-mail-notifications - [`6c3fd33`](https://github.com/go-vikunja/vikunja/commit/6c3fd33de82b3cd775025af30c303f6bc7682f66) fix: use hostname - [`efe8dc6`](https://github.com/go-vikunja/vikunja/commit/efe8dc66fe2c21c7734e097124e3137bb37ccaa1) fix lint - [`4c0e32d`](https://github.com/go-vikunja/vikunja/commit/4c0e32d7e12eb20aa6a9705d3e5571619f03ef75) feat: add tests for thread id ### 📊 Changes **8 files changed** (+166 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `go.sum` (+0 -4) 📝 `pkg/mail/send_mail.go` (+6 -0) 📝 `pkg/models/notifications.go` (+44 -0) ➕ `pkg/models/notifications_test.go` (+85 -0) 📝 `pkg/notifications/mail.go` (+7 -0) 📝 `pkg/notifications/mail_render.go` (+1 -0) 📝 `pkg/notifications/mail_test.go` (+15 -0) 📝 `pkg/notifications/notification.go` (+8 -0) </details> ### 📄 Description Task-related email notifications (comments, reminders, assignments, etc.) now include thread IDs to enable email client threading. All notifications for the same task share a common Message-ID format thread identifier. ## Changes **Notification interface** (`pkg/notifications/notification.go`) - Added `ThreadID` interface with `ThreadID() string` method - Updated `notifyMail()` to apply thread ID when notification implements the interface **Mail pipeline** (`pkg/notifications/mail.go`, `pkg/notifications/mail_render.go`, `pkg/mail/send_mail.go`) - Added `threadID` field to `Mail` struct with setter method - Extended `mail.Opts` with `ThreadID` field - Modified `getMessage()` to set `In-Reply-To` and `References` headers **Task notifications** (`pkg/models/notifications.go`) - Implemented `ThreadID()` for: `ReminderDueNotification`, `TaskCommentNotification`, `TaskAssignedNotification`, `TaskDeletedNotification`, `UndoneTaskOverdueNotification`, `UserMentionedInTaskNotification` - Thread ID format: `<task-{id}@{domain}>` where domain is extracted from `ServicePublicURL` config **Example** For task ID 123 on instance at `https://vikunja.example.com`: ``` Thread-ID: <task-123@vikunja.example.com> In-Reply-To: <task-123@vikunja.example.com> References: <task-123@vikunja.example.com> ``` All task notifications now thread correctly in Gmail, Outlook, Apple Mail, and other RFC 5322 compliant clients. <!-- START COPILOT CODING AGENT SUFFIX --> <details> <summary>Original prompt</summary> > Every notification that's somehow belonging to a task (a comment, a reminder, a single overdue notification, an assignee notice) should have a thread id in the mail message. use the task id for that. For that, extend the message interface with a new method "ThreadID()" and pass it down to where the mail is actually put together and sent. You know how thread ids work for mails, look at the library used to figure out how to add it to the mail. </details> <!-- START COPILOT CODING AGENT TIPS --> --- 💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more [Copilot coding agent tips](https://gh.io/copilot-coding-agent-tips) in the docs. --- <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 17:54:19 -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#7841