justinm reported an issue where enabling push notifications during initial onboarding on iOS does not actually subscribe users, despite showing a confirmation notification. The workaround involves manually enabling notifications in the notification preferences. justinm submitted a pull request (#34644) to address this issue, which sam acknowledged would be reviewed. justinm updated the PR, noting it improves Discourse’s WebPush integration and provides an extension point for prompting iOS users to install Discourse as a PWA. After deploying the change, justinm confirmed it works on both desktop and Android, with users successfully subscribed to push notifications. The prompt is gated behind a setting. sam appreciated the work and promised a review after their meetup.
During initial onboarding, I’ve observed that iOS users will install the forums as a PWA and then receive the notification consent banner when they first open the PWA.
If they click “enable notifications” in this consent banner, they are prompted for permissions and the confirmation notification is sent to them afterwards.
However, this does not actually subscribe users for push notifications, which is unexpected!
It appears that for the notification consent banner, the code here will go down the else path first to request user consent (Notification.requestPermission) but it will NOT subscribe to push notifications (subscribePushNotification).
The workaround at this point is for users to go to their notification preferences and click the “enable notifications” button there.
I’ve done some more work on that PR since posting it - hopefully it won’t be too much
I think this’ll substantially improve Discourse’s integration with WebPush, and it should give y’all an extension point that you can use to prod iOS users to install Discourse as a PWA.
I’ve deployed that change to my forums and it is now live.
I think this’ll really increase participation from my users
I’ve asked someone to check my forums and have confirmed that they were asked to enable push notifications (on both desktop and Android). They’re also signed up on the backend (in the push_notifications table).
Now all that is left is to get everyone else to check the forums again.
P.S: This prompt is still gated behind this setting: