Skip to content
Snippets Groups Projects
Unverified Commit 1fadde01 authored by Anton Georgiev's avatar Anton Georgiev Committed by GitHub
Browse files

Merge pull request #5697 from MaximKhlobystov/chat-notifications-timing

Chat push notifications timing
parents 0fa7810e 327f1016
No related branches found
No related tags found
No related merge requests found
......@@ -3,9 +3,11 @@ import PropTypes from 'prop-types';
import _ from 'lodash';
import injectNotify from '/imports/ui/components/toast/inject-notify/component';
import { Link } from 'react-router';
import cx from 'classnames';
import { styles } from '../../styles.scss';
const NOTIFICATION_INTERVAL = 2000; // 2 seconds
const NOTIFICATION_LIFETIME = 4000; // 4 seconds
const propTypes = {
notify: PropTypes.func.isRequired,
onOpen: PropTypes.func.isRequired,
......@@ -22,7 +24,7 @@ class ChatPushNotification extends React.Component {
constructor(props) {
super(props);
this.showNotify = _.debounce(this.showNotify.bind(this), 5000);
this.showNotify = _.debounce(this.showNotify.bind(this), NOTIFICATION_INTERVAL);
this.componentDidMount = this.showNotify;
this.componentDidUpdate = this.showNotify;
......@@ -37,7 +39,14 @@ class ChatPushNotification extends React.Component {
content,
} = this.props;
return notify(ChatPushNotification.link(message, chatId), 'info', 'chat', { onOpen, autoClose: 2000 }, ChatPushNotification.link(content, chatId), true);
return notify(
ChatPushNotification.link(message, chatId),
'info',
'chat',
{ onOpen, autoClose: NOTIFICATION_LIFETIME },
ChatPushNotification.link(content, chatId),
true,
);
}
render() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment