about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/features/notifications/index.js
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2020-10-13 00:37:21 +0200
committerThibaut Girka <thib@sitedethib.com>2020-10-21 21:28:47 +0200
commitb5927301cf086035cb3e5eac008cad12bcdcb352 (patch)
treeb67e158af4cf80c6bdabb22b22b8e0234ec74d3c /app/javascript/flavours/glitch/features/notifications/index.js
parent2eb054c07f37fc2a7b3881e25e4d26a3410fe56b (diff)
[Glitch] Fix browser notification permission request logic
Port f54ca3d08e068af07a5b7a8b139e7658b3236db8 to glitch-soc

Signed-off-by: Thibaut Girka <thib@sitedethib.com>
Diffstat (limited to 'app/javascript/flavours/glitch/features/notifications/index.js')
-rw-r--r--app/javascript/flavours/glitch/features/notifications/index.js3
1 files changed, 3 insertions, 0 deletions
diff --git a/app/javascript/flavours/glitch/features/notifications/index.js b/app/javascript/flavours/glitch/features/notifications/index.js
index 18db7e0d2..87fb3074b 100644
--- a/app/javascript/flavours/glitch/features/notifications/index.js
+++ b/app/javascript/flavours/glitch/features/notifications/index.js
@@ -62,6 +62,7 @@ const mapStateToProps = state => ({
   notifCleaningActive: state.getIn(['notifications', 'cleaningMode']),
   lastReadId: state.getIn(['notifications', 'readMarkerId']),
   canMarkAsRead: state.getIn(['notifications', 'readMarkerId']) !== '0' && getNotifications(state).some(item => item !== null && compareId(item.get('id'), state.getIn(['notifications', 'readMarkerId'])) > 0),
+  needsNotificationPermission: state.getIn(['settings', 'notifications', 'alerts']).includes(true) && state.getIn(['notifications', 'browserSupport']) && state.getIn(['notifications', 'browserPermission']) !== 'granted',
 });
 
 /* glitch */
@@ -105,6 +106,7 @@ class Notifications extends React.PureComponent {
     onUnmount: PropTypes.func,
     lastReadId: PropTypes.string,
     canMarkAsRead: PropTypes.bool,
+    needsNotificationPermission: PropTypes.bool,
   };
 
   static defaultProps = {
@@ -333,6 +335,7 @@ class Notifications extends React.PureComponent {
           multiColumn={multiColumn}
           localSettings={this.props.localSettings}
           extraButton={extraButtons}
+          collapseIssues={this.props.needsNotificationPermission}
           appendContent={notifCleaningDrawer}
         >
           <ColumnSettingsContainer />