Skip to content

Fix: Auto-create notification templates when missing for agent offline notifications#86

Closed
Copilot wants to merge 2 commits intomainfrom
copilot/fix-issue-80
Closed

Fix: Auto-create notification templates when missing for agent offline notifications#86
Copilot wants to merge 2 commits intomainfrom
copilot/fix-issue-80

Conversation

Copy link

Copilot AI commented Dec 3, 2025

Agent offline notifications fail with "找不到通知模板" (template not found) for users created before default templates were added in PR #81.

Changes

  • Added createDefaultTemplatesForUser(userId) helper that creates default Monitor and Agent notification templates
  • Modified sendNotification to auto-create templates when user has none:
// In sendNotification()
let templates = await repositories.getNotificationTemplates(userId);

if (templates.length === 0) {
  await createDefaultTemplatesForUser(userId);
  templates = await repositories.getNotificationTemplates(userId);
}

This provides backward compatibility for existing users without requiring manual template setup.

Original prompt

fix this issue:
#80


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

When sending agent offline notifications, if the user has no notification
templates (e.g., for users created before default templates feature was
added), automatically create default Monitor and Agent templates.

This ensures notifications can be sent even for older users who don't
have templates configured.

Co-authored-by: zaunist <38528079+zaunist@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix issue with user profile validation Fix: Auto-create notification templates when missing for agent offline notifications Dec 3, 2025
Copilot AI requested a review from zaunist December 3, 2025 05:07
@zaunist zaunist closed this Dec 16, 2025
@zaunist zaunist deleted the copilot/fix-issue-80 branch December 16, 2025 22:24
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.

2 participants