Skip to content

fix(notifications): pass room and userId context to reaction notification filter#673

Closed
Just-Insane wants to merge 5 commits intoSableClient:devfrom
Just-Insane:fix/reaction-notification-context
Closed

fix(notifications): pass room and userId context to reaction notification filter#673
Just-Insane wants to merge 5 commits intoSableClient:devfrom
Just-Insane:fix/reaction-notification-context

Conversation

@Just-Insane
Copy link
Copy Markdown
Contributor

Description

isNotificationEvent in room.ts already has logic to only surface reaction notifications for reactions to the current user's messages — but both call sites were invoking it without the required room and userId arguments, causing it to hit the safe-default branch that silently filters out all reactions.

This change passes room and mx.getUserId() at both notification paths so the existing filter works as intended:

  • BackgroundNotifications.tsx — background/multi-account notification path
  • ClientNonUIFeatures.tsx — foreground in-app notification path

Fixes #

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings

AI disclosure:

  • Partially AI assisted (clarify which code was AI assisted and briefly explain what it does).

The two changed call sites were identified and modified with AI assistance. The fix passes room and mx.getUserId() ?? undefined to isNotificationEvent so that the existing reaction-ownership check in room.ts receives the context it needs to function correctly.

Copilot AI review requested due to automatic review settings April 12, 2026 21:11
@Just-Insane Just-Insane requested review from 7w1 and hazre as code owners April 12, 2026 21:11
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes reaction notifications being silently filtered out by ensuring isNotificationEvent receives the required room and userId context at both notification entry points.

Changes:

  • Pass room and mx.getUserId() ?? undefined into isNotificationEvent in the foreground (in-app) notification path.
  • Pass room and mx.getUserId() ?? undefined into isNotificationEvent in the background/multi-account notification path.
  • Add a changeset documenting the patch-level fix.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/app/pages/client/ClientNonUIFeatures.tsx Fixes foreground notification filtering by providing room/userId context to reaction filtering logic.
src/app/pages/client/BackgroundNotifications.tsx Fixes background notification filtering by providing room/userId context to reaction filtering logic.
.changeset/reaction-notification-context.md Documents the user-facing patch change for release notes/versioning.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

}

if (!room || isHistoricalEvent || room.isSpaceRoom() || !isNotificationEvent(mEvent)) {
if (!room || isHistoricalEvent || room.isSpaceRoom() || !isNotificationEvent(mEvent, room, mx.getUserId() ?? undefined)) {
Copy link

Copilot AI Apr 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This condition line exceeds the repo’s Prettier printWidth (100) and will fail pnpm run fmt:check. Please run Prettier (or wrap the if condition across multiple lines) so formatting checks pass.

Suggested change
if (!room || isHistoricalEvent || room.isSpaceRoom() || !isNotificationEvent(mEvent, room, mx.getUserId() ?? undefined)) {
if (
!room ||
isHistoricalEvent ||
room.isSpaceRoom() ||
!isNotificationEvent(mEvent, room, mx.getUserId() ?? undefined)
) {

Copilot uses AI. Check for mistakes.
default: patch
---

Fix reaction notifications not being delivered by passing room and user context to the notification event filter
Copy link

Copilot AI Apr 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The release-note line is over the repo’s Prettier printWidth (100) and will be reformatted/fail pnpm run fmt:check. Please wrap the summary onto multiple lines (keeping it as a single paragraph).

Suggested change
Fix reaction notifications not being delivered by passing room and user context to the notification event filter
Fix reaction notifications not being delivered by passing room and user
context to the notification event filter

Copilot uses AI. Check for mistakes.
@Just-Insane Just-Insane marked this pull request as draft April 17, 2026 11:55
@Just-Insane Just-Insane deleted the fix/reaction-notification-context branch April 17, 2026 19:06
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