Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix notifications not being sent on decryption correction #1992

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

TrojanerHD
Copy link

@TrojanerHD TrojanerHD commented Oct 4, 2024

Description

Fixes #1892

My analysis in the issue actually seems to be wrong. The root cause for this issue is not the cache but the fact that the matrix-js-sdk sends a timeline event before calling the fixNotificationCountOnDecryption function (see https://github.com/matrix-org/matrix-js-sdk/blob/da044820d7d3255e41e403bfbd035bf7b90ddd6a/src/client.ts#L10322). This leads to the edge case that cinny returns in the sendTimelineEvent function as the counter is 0 before it is corrected to 1.

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

Copy link

github-actions bot commented Oct 4, 2024

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@TrojanerHD
Copy link
Author

I have read the CLA Document and I hereby sign the CLA

ajbura added a commit to cinnyapp/cla that referenced this pull request Oct 4, 2024
@TrojanerHD TrojanerHD force-pushed the fix-notification-for-first-message branch from 25e4699 to 80b8526 Compare October 20, 2024 20:18
Comment on lines +208 to +212
const handleUnreadEvent: RoomEventHandlerMap[RoomEvent.UnreadNotifications] = () => {
handleTimelineEvent(mEvent, room, toStartOfTimeline, removed, data);
room.removeListener(RoomEvent.UnreadNotifications, handleUnreadEvent);
};
room.on(RoomEvent.UnreadNotifications, handleUnreadEvent);
Copy link
Member

@ajbura ajbura Nov 27, 2024

Choose a reason for hiding this comment

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

since you are removing the listener inside event handler, it feels like to me that following change may lead to memory leaks where the event handler is set but never gets removed because you never hear from it?

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.

Notifications not sent on edge case
2 participants