fix(notifications): return Notification-like stub so Teams can manage lifecycle#2329
fix(notifications): return Notification-like stub so Teams can manage lifecycle#2329IsmaelMartinez wants to merge 5 commits intomainfrom
Conversation
… lifecycle Teams calls addEventListener, close(), and dispatchEvent() on the object returned by new Notification(). Our bare stubs lacked these methods, breaking Teams' internal state machine after the first notification and causing subsequent messages to only show title-based unread counts. Fixes #2248 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
✅ Changelog entry generated and committed to this PR: The file You can edit it directly in this PR if needed. |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request resolves a critical issue where Microsoft Teams' notification handling would fail after the initial notification due to an incomplete stub object lacking essential methods like Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request effectively addresses the issue of Teams' notification lifecycle management by introducing a shared createNotificationStub helper. This ensures that a consistent, more complete Notification-like object is returned across all notification paths, which should fix the bug where subsequent notifications were failing. The refactoring is clean and the logic is sound. I have one suggestion to make the new stub function even more robust.
📦 PR Snap Build Artifacts✅ Snap builds successful! Download artifacts: 🐧 Linux Snap Packagesx86_64 (107.29 MB) arm64 (104.20 MB) armv7l (98.43 MB) 📝 Note: Other package formats (.deb, .rpm, .AppImage, .dmg, .exe) are built in the main workflow |
📦 PR Build Artifacts✅ Build successful! Download artifacts: 🐧 Linuxx86_64 (434.10 MB) - Contains: .deb, .rpm, .tar.gz, .AppImage arm64 (425.30 MB) - Contains: .deb, .rpm, .tar.gz, .AppImage armv7l (403.39 MB) - Contains: .deb, .rpm, .tar.gz, .AppImage 🍎 macOSx86_64 (124.85 MB) - Contains: .dmg 🪟 Windowsx86_64 (105.43 MB) - Contains: .exe installer 📝 Note: Snap packages (.snap) are built in a separate workflow 🕐 Last updated: 2026-03-13 11:15 UTC |
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… only Web notification path returns the real Notification object (or null on failure), preserving Teams' ability to manage its own lifecycle. The Notification-like stub is only needed for electron and custom methods where the actual notification is handled out-of-process. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Verifies that the preload.js Notification override returns objects with the lifecycle methods Teams expects (addEventListener, removeEventListener, close, dispatchEvent). Covers electron, custom, and web notification methods. Tests run without authentication, so they work both locally and in the cross-distro Docker containers. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|


Summary
addEventListener,close(), anddispatchEvent()on the object returned bynew Notification(). Our bare{ onclick, onclose, onerror }stubs lacked these methods, breaking Teams' internal notification state machine after the first notification.createNotificationStub()helper that returns a proper Notification-like object and applies it to all code paths (electron, custom, web fallback, disabled notifications).customnotification method. This applies the same fix to all methods.Fixes #2248
Test plan
npm run lintpassesnpm run test:e2epassesnotificationMethod: "electron"— subsequent chat messages should show message content, not just unread countnotificationMethod: "web"— same verificationnotificationMethod: "custom"— same verification🤖 Generated with Claude Code