matrix-org / dendrite

Dendrite is a second-generation Matrix homeserver written in Go!
https://matrix-org.github.io/dendrite/
Apache License 2.0
5.67k stars 664 forks source link

Defaults for 1:1 chat notifications are not obeyed for Android push notifications #2537

Open PaulosV opened 2 years ago

PaulosV commented 2 years ago

Background information

Description

Steps to reproduce

The Android client in the background gets no notification. It should have gotten something. It receives all the notifications when it goes back in the foreground.

jittygitty commented 2 years ago

@PaulosV Try a trigger to populate the notifications rules, such as for element android see: https://github.com/vector-im/element-android/issues/6115#issuecomment-1137890525 and https://github.com/matrix-org/dendrite/pull/2484

S7evinK commented 1 year ago

Possibly related to Dendrite not sending the notification count to the push gateway - should be fixed by https://github.com/matrix-org/dendrite/pull/2683. Does this still happen? If so, it may also be related to the push gateway (default matrix.org) being overloaded and takes some time to process everything.

PaulosV commented 1 year ago

@PaulosV Try a trigger to populate the notifications rules, such as for element android see: vector-im/element-android#6115 (comment) and #2484

I was trying to work out how to populate the rules, but I have tried to turn the notifications off and on several times, and the notifications rules were definitely present. And the notifications eventually worked, but not for the mentioned 1:1 chats.

Possibly related to Dendrite not sending the notification count to the push gateway - should be fixed by #2683. Does this still happen? If so, it may also be related to the push gateway (default matrix.org) being overloaded and takes some time to process everything.

I'll check but when I set the notifications to "All messages", it worked, so it was really something wrong with the "default" option - the original Element for Android did not have that option for 1:1 chats, instead there was an "All messages" and "None". I also don't think it was a problem with overload, when the notification did come, it was instant, and when it did not come, it has never come after.

S7evinK commented 1 year ago

Ah, okay. Just remembered that there was #2705, which tweaked the 1:1 notification actions for encrypted rooms. If it's still not working, it may be necessary to recreate the default rules provided by Dendrite. This can be done by deleting them from the database:

DELETE FROM userapi_account_datas WHERE type = 'm.push_rules' AND localpart = '$yourUserLocalpart'

They will be recreated on the next notification. You'll need to do an initial sync after that, so Element Android fetches the newly created rules.

If you say "All messages" and "None", those seem to be the normal options for encrypted rooms.

PaulosV commented 1 year ago

Thanks for the tips, I've tried to update Dendrite to 0.10.4, removed the rules from the database, signed out and back in, and created an entirely new 1:1 E2E-encrypted direct messaging (it's over federation, btw). Still no push notifications in my SchildiChat (Android) without manually changing to "All messages" in the menu.

Edit: The 1:1 conversation was created via federation from Element on desktop.

PaulosV commented 1 year ago

Actually, here's the interesting part now.

When I create the conversation on my Dendrite homeserver - either rfrom my SchildiChat Android, or the Element on desktop, then the notifications are set up correctly and they work on my Android! The SchildiChat client still shows "Default" for the notification settings, but it works.

But when I do it the other way around - I create the channel on the other end of the federation (Synapse homeserver), then I get no push notifications at Dendrite unless I change the setting from "Default" to "All notifications".