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

Unnecessary notification when joining group #32

Open
Bobbykart opened this issue May 9, 2022 · 5 comments
Open

Unnecessary notification when joining group #32

Bobbykart opened this issue May 9, 2022 · 5 comments

Comments

@Bobbykart
Copy link

Bobbykart commented May 9, 2022

The function in index.js duplicateTimelineOnJoinGroup triggers the function sendNotification in push-notification.js. So if someone joins a group chat with 1000 users, the user gets 1000 push notifications from system. Is there a way to stop this?

@sponzillo
Copy link
Contributor

sponzillo commented May 10, 2022 via email

@andrealeo83
Copy link
Contributor

the function duplicateTimelineOnJoinGroup disable the notification when someone joins the chat. As you see from the code below:
image
Only one notification is sent.

@Bobbykart
Copy link
Author

Wrong. There is no database field called attributes.sendnotification and is not even mentioned in the sendNotification function. There is only forcenotification and only this field is asked in a if-statement in sendNotification. I had to rewrite the code and replace message.atteibutes.sendnotification to message.attributes.forcenotification.

@andrealeo83
Copy link
Contributor

the logic is this:
if you send a message with message.attributes.forcenotification=true then a notification is sent for each message
if you send a message without message.attributes.forcenotification=true then a notification is sent only for the first message

@Bobbykart
Copy link
Author

Yes but the forcenotification isn't set to false in the code. Therefore the system messages, which were true in one node, are copied as true and bypass the if-statement in sendNotification. The joined user gets all system messages of the chatgroup because of the onCreate. The code you provided is useless because in push-notifications.js the field message.attributes.sendnotification isnt mentioned once.

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

No branches or pull requests

3 participants