Allow push notifications in user's notifications settings#8749
Allow push notifications in user's notifications settings#8749
Conversation
3553450 to
041f069
Compare
|
Can you fill the PR template @quinHD 🙏🏽? |
|
@quinHD could you review the broken spec? The rest is fine, so ping product when ready |
|
Ready to review @andreslucena |
andreslucena
left a comment
There was a problem hiding this comment.
Some small changes to apply 🙏🏽
|
I was trying to force the notification browser consent dialog but couldn't do it locally, so I'd probably need to check it in the staging server. Let me know when you have it please. |
a7de219 to
42411b8
Compare
andreslucena
left a comment
There was a problem hiding this comment.
I've just tested one last time and the flow is exactly what I had in mind, congratulations!!
I have a couple doubts and a minor CSS reflow that we need to change.
decidim-core/app/views/decidim/notifications_settings/show.html.erb
Outdated
Show resolved
Hide resolved
decidim-core/app/views/decidim/notifications_settings/show.html.erb
Outdated
Show resolved
Hide resolved
decidim-core/app/views/decidim/notifications_settings/show.html.erb
Outdated
Show resolved
Hide resolved
10e6153 to
a687708
Compare
|
@quinHD I see that you have two flaky tests:
|
|
Is this ready to be reviewed @quinHD? Have you deploy it to https://decidim.populate.tools? Is the bug from my last comment fixed? |
|
Yes to all. The only thing to keep in mind is that parte of the logic of the allow push notifications is modified in the other PR |
|
@quinHD I still see the same behavior with Opera Mini: it shows the checkbox, and it doesn't ask for my permissions at the browser because it doesn't support it. |
Hmm, I think the problem is that the browser also doesn't support new JS features, so it breaks the flow. This way, when it's going to check if it has to render the check button or not, it can't because there's an error. |
|
Just talked about the Opera Mini thing that I was mentioning in my last couple of comments with @quinHD outside of GitHub, and it seems like this is only a thing with Opera Mini:
So as discussed, in this particular case as it seems a problem with this particular browser, and it isn't a browser with much traction, we'll do a hard-coded User Agent reject list or a similar strategy. |
Done! I added a User Agent rejection. Opera mini doesn't have its own User Agent. So I use the opera identifier and the mobile tag. I think it will affect also the Opera mobile browser. |
|
|
||
| class AddAllowPushNotificationsToUsers < ActiveRecord::Migration[6.0] | ||
| def change | ||
| add_column :decidim_users, :allow_push_notifications, :boolean, default: false |
There was a problem hiding this comment.
After #8757 we have the notifications_settings JSONB column.
I see that's actually being used by the related PR #8774, so I think it makes sense to also migrate this column to notifications_settings, so it's all consistent. I know it can be a bit more of an effort but in the long term it's going to be there, so I think it's better to do it sooner than later. What do you think @quinHD?
There was a problem hiding this comment.
since this column will disappear in the other PR. We have considered that this PR can be closed and its functionality will be taken over by the push-notifications-to-client PR.

🎩 What? Why?
This PR adds option to the user to allow push notifications in the profile panel.
📌 Related Issues
Issue #8489
Testing
You can test this feature visiting
/notifications_settings. When you enablePush notificationsyou have to allow also notifications in the browser popup.Acceptance criteria
When I go to "My account" -> "Notifications settings"
Then I see a section called "Push notifications"
and when I check this setting
Then I get asked for permission to receive Push notifications
When I go to "My account" -> "Notifications settings"
Then I don't see the "Push notifications" section.
When I go to "My account" -> "Notifications settings"
Then I see a section called "Push notifications" with the following message:
When I go to "My account" -> "Notifications settings"
Then I see a section called "Push notifications"
and when I uncheck this setting
Then I've revoked permission to receive Push notifications
📋 Checklist
🚨 Please review the guidelines for contributing to this repository.
docs/.📷 Screenshots
Please add screenshots of the changes you're proposing

♥️ Thank you!