mirror of
https://github.com/nickzuber/meteorite.git
synced 2024-09-11 11:36:03 +03:00
Fix notifications bug
This commit is contained in:
parent
42688b0221
commit
8a8f4b0e94
3
.gitignore
vendored
3
.gitignore
vendored
@ -19,6 +19,3 @@
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# private
|
||||
/src/utils/mocks.js
|
||||
|
@ -270,6 +270,7 @@ class NotificationsPage extends React.Component {
|
||||
body: reasonByline,
|
||||
icon: n.type === "Issue" ? issueIcon : prIcon,
|
||||
badge: n.type === "Issue" ? issueIcon : prIcon,
|
||||
requireInteraction: true,
|
||||
});
|
||||
|
||||
notification.addEventListener('click', () => {
|
||||
@ -278,7 +279,7 @@ class NotificationsPage extends React.Component {
|
||||
})
|
||||
|
||||
// Manually close for legacy browser support.
|
||||
setTimeout(notification.close.bind(notification), 4000);
|
||||
setTimeout(notification.close.bind(notification), 10000);
|
||||
}
|
||||
|
||||
getFilteredNotifications = () => {
|
||||
@ -347,10 +348,12 @@ class NotificationsPage extends React.Component {
|
||||
}
|
||||
|
||||
if (this.props.notificationsApi.newChanges) {
|
||||
// we shouldn't do it like this. instead, we should have an additional state called
|
||||
// "new changes" or something that the notifications api knows about.
|
||||
// this will be whatever we get in the syncing/fetching response
|
||||
this.sendWebNotification(this.props.notificationsApi.newChanges);
|
||||
const filteredNewChanges = this.props.notificationsApi.newChanges.filter(n => (
|
||||
scoredAndSortedNotifications.some(fn => fn.id === n.id)
|
||||
));
|
||||
if (filteredNewChanges.length > 0) {
|
||||
this.sendWebNotification(filteredNewChanges);
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
|
@ -1,9 +1,9 @@
|
||||
import React from 'react';
|
||||
import moment from 'moment';
|
||||
import {Status} from '../constants/status';
|
||||
import {createMockNotifications} from '../utils/mocks';
|
||||
// import {createMockNotifications} from '../utils/mocks';
|
||||
|
||||
const mockNotifications = createMockNotifications(100);
|
||||
// const mockNotifications = createMockNotifications(100);
|
||||
|
||||
export const LOCAL_STORAGE_PREFIX = '__meteorite_noti_cache__';
|
||||
export const LOCAL_STORAGE_USER_PREFIX = '__meteorite_user_cache__';
|
||||
|
Loading…
Reference in New Issue
Block a user