Skip to content

Add raw text diff to end-of-edit notification emails#141

Draft
Copilot wants to merge 7 commits into
mainfrom
copilot/add-diff-to-email-notifications
Draft

Add raw text diff to end-of-edit notification emails#141
Copilot wants to merge 7 commits into
mainfrom
copilot/add-diff-to-email-notifications

Conversation

Copy link
Copy Markdown

Copilot AI commented May 13, 2026

This plugin notifies subscribers when editing starts/ends, but end-of-edit emails previously only included a pad link. This change adds a raw, line-based diff so recipients can quickly see what changed without opening the pad.

  • Diff content in end-of-edit emails

    • Capture pad text at the beginning of an edit session.
    • On stale/end notification, compare start vs final text.
    • Append a raw +/- line diff to the “finished editing” email body.
  • Diff generation helper

    • Added textDiff.js to produce deterministic line-based diffs.
    • Uses LCS for normal-sized inputs.
    • Includes fallback limits for large inputs to avoid excessive CPU/memory and oversized email content.
  • Session/race handling

    • Timer/session state now carries startText.
    • End notification consumes captured start state explicitly, avoiding cross-session/missing-state edge cases.
  • Regression coverage

    • Added backend tests for unchanged, added, removed, replaced, and large-input fallback diff behavior.
// update.js (end notification flow)
const startText = timer ? timer.startText : null;
delete timers[padId];
await notifyEnd(padId, startText);

// notifyEnd()
const {text = ''} = await API.getText(padId);
const diffText = textDiff(startText, text);
// ...append diffText to email body when non-empty

Copilot AI linked an issue May 13, 2026 that may be closed by this pull request
Copilot AI and others added 6 commits May 13, 2026 10:24
Copilot AI changed the title [WIP] Add diff to email notifications for pad updates Add raw text diff to end-of-edit notification emails May 13, 2026
Copilot AI requested a review from JohnMcLear May 13, 2026 10:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add a diff to the mail

2 participants