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*
|
npm-debug.log*
|
||||||
yarn-debug.log*
|
yarn-debug.log*
|
||||||
yarn-error.log*
|
yarn-error.log*
|
||||||
|
|
||||||
# private
|
|
||||||
/src/utils/mocks.js
|
|
||||||
|
@ -270,6 +270,7 @@ class NotificationsPage extends React.Component {
|
|||||||
body: reasonByline,
|
body: reasonByline,
|
||||||
icon: n.type === "Issue" ? issueIcon : prIcon,
|
icon: n.type === "Issue" ? issueIcon : prIcon,
|
||||||
badge: n.type === "Issue" ? issueIcon : prIcon,
|
badge: n.type === "Issue" ? issueIcon : prIcon,
|
||||||
|
requireInteraction: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
notification.addEventListener('click', () => {
|
notification.addEventListener('click', () => {
|
||||||
@ -278,7 +279,7 @@ class NotificationsPage extends React.Component {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// Manually close for legacy browser support.
|
// Manually close for legacy browser support.
|
||||||
setTimeout(notification.close.bind(notification), 4000);
|
setTimeout(notification.close.bind(notification), 10000);
|
||||||
}
|
}
|
||||||
|
|
||||||
getFilteredNotifications = () => {
|
getFilteredNotifications = () => {
|
||||||
@ -347,10 +348,12 @@ class NotificationsPage extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.props.notificationsApi.newChanges) {
|
if (this.props.notificationsApi.newChanges) {
|
||||||
// we shouldn't do it like this. instead, we should have an additional state called
|
const filteredNewChanges = this.props.notificationsApi.newChanges.filter(n => (
|
||||||
// "new changes" or something that the notifications api knows about.
|
scoredAndSortedNotifications.some(fn => fn.id === n.id)
|
||||||
// this will be whatever we get in the syncing/fetching response
|
));
|
||||||
this.sendWebNotification(this.props.notificationsApi.newChanges);
|
if (filteredNewChanges.length > 0) {
|
||||||
|
this.sendWebNotification(filteredNewChanges);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import {Status} from '../constants/status';
|
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_PREFIX = '__meteorite_noti_cache__';
|
||||||
export const LOCAL_STORAGE_USER_PREFIX = '__meteorite_user_cache__';
|
export const LOCAL_STORAGE_USER_PREFIX = '__meteorite_user_cache__';
|
||||||
|
Loading…
Reference in New Issue
Block a user