Skip to content

Notification Aggregation / Digest Mode #4624

@shepilov

Description

@shepilov

Summary

Instead of silently dropping notifications during the MinInterval period, collect them and send a single aggregated email with a summary of all events.

Context

Current behavior with MinInterval:
User uploads 50 files in 5 minutes, MinInterval = 30 minutes

  • 00:00 - File 1 uploaded → Email sent ✓
  • 00:01 - File 2 uploaded → SKIPPED
  • 00:02 - File 3 uploaded → SKIPPED
  • ...
  • 00:05 - File 50 uploaded → SKIPPED

Result: User receives 1 email about File 1, never learns about files 2-50

Proposal

  • 00:00 - File 1 uploaded → Email sent ✓
  • 00:01 - File 2 uploaded → Queued
  • 00:02 - File 3 uploaded → Queued
  • ...
  • 00:30 - Interval expires → Digest email with files 2-50 ✓

Result: User receives 2 emails - immediate + digest with all files listed

type Properties struct {
      // ...

      Aggregate      bool   `json:"aggregate,omitempty"`       // Enable email aggregation
      DigestTemplate string `json:"digest_template,omitempty"` // Template for digest email
  }
type Notification struct {
      // ...

      // Status: "sent" (default), "pending" (queued for digest), "aggregated"
      Status string `json:"status,omitempty"`
  }
NotificationSharingFileChanged: {
      Description:    "Notify about new files in sharings",
      Collapsible:    false,
      Aggregate:      true,
      MinInterval:    5 * time.Minute,
      MailTemplate:   "sharing_file_changed",         // Single file email
      DigestTemplate: "sharing_file_changed_digest",  // Aggregated email
      Aggregator:     aggregateSharingFileChanges,
  },
func aggregateFileChanges(notifs []*notification.Notification) map[string]interface{} {
      // ... aggregation logic
 }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions