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

Change notification permission handling #15176

Merged

Conversation

ClearlyClaire
Copy link
Contributor

  • allow changing individual alert settings even if permission is not explicitly enabled (asks for permission on toggle)
  • persist permission request banner dismissal across sessions through settings

This enables the dismissal of the nagging notification permission banner to persist after a reload or across browsers without breaking the ability to enable notifications later.

Another approach could be to have the alert settings bound to localStorage or to the session, and disable all alerts when dismissing the banner, but that would be a change of behavior and provide an uneasy migration path.

@ClearlyClaire ClearlyClaire force-pushed the fixes/notification-webpush-banner branch from 7734be4 to 05ceb2f Compare November 16, 2020 15:55
@ClearlyClaire
Copy link
Contributor Author

One possible issue with this is that there is no clear indication that notifications won't work when the permission isn't granted (nor explicitly denied) and the banner has been dismissed…

@ClearlyClaire ClearlyClaire marked this pull request as ready for review November 16, 2020 16:14
@ClearlyClaire ClearlyClaire force-pushed the fixes/notification-webpush-banner branch 2 times, most recently from dc54a40 to 99949f4 Compare November 16, 2020 17:07
@ClearlyClaire
Copy link
Contributor Author

Added back a message and button for the case where notifications have not been granted (nor explicitly denied).

image

This appears with the same conditions as the banner, but only in the settings, so it's not nagging, and can still be helpful to diagnose misconfiguration.

render () {
return (
<button className='text-btn column-header__setting-btn' tabIndex='0' onClick={this.props.onClick}>
<Icon id='sliders' /> <FormattedMessage id='notifications.grant_permission' defaultMessage='Grant permission' />
Copy link
Member

Choose a reason for hiding this comment

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

Why is the icon sliders? In the banner, I used the icon to point to the column settings area, but it is not the icon for permissions or desktop notifications.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This seems to be the most fitting “settings icon” to me, although it's already used for column settings, so I understand it may be confusing. I don't know which icon would be better.

{alertsEnabled && browserSupport && browserPermission === 'default' && (
<div className='column-settings__row column-settings__row--with-margin'>
<span className='warning-hint'><FormattedMessage id='notifications.permission_required' defaultMessage='Desktop notifications are unavailable because the required permission has not been granted.' /></span>
<GrantPermissionButton onClick={onRequestNotificationPermission} />
Copy link
Member

Choose a reason for hiding this comment

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

There needs to be margin between the line above and the button.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wanted it to be visually grouped with the text.

image

Would this be better?

image

Copy link
Member

Choose a reason for hiding this comment

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

Okay, with the differnet margin to the button below, it's not worse but not better either. If you want it to be visually grouped, why not make the "button" have the same text color and maybe even make it inline part of the text like a link, underlined?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Something like this?

image

Copy link
Member

Choose a reason for hiding this comment

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

Looks nice!

- allow changing individual alert settings even if permission is not explicitly
  enabled (asks for permission on toggle)
- persist permission request banner dismissal across sessions through settings
@ClearlyClaire ClearlyClaire force-pushed the fixes/notification-webpush-banner branch from 99949f4 to adfd8c5 Compare December 15, 2020 10:28
@ClearlyClaire
Copy link
Contributor Author

Changed the permission grant button design according to reviews:
image

@ClearlyClaire ClearlyClaire force-pushed the fixes/notification-webpush-banner branch from de78f3b to 570c9b0 Compare December 15, 2020 17:00
@ClearlyClaire ClearlyClaire force-pushed the fixes/notification-webpush-banner branch from 570c9b0 to 276c5c3 Compare December 15, 2020 17:05
@Gargron Gargron merged commit 79efcf8 into mastodon:master Dec 15, 2020
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.

None yet

2 participants