Skip to content

Commit

Permalink
Fixing logging errors for Franz (mattermost#7273)
Browse files Browse the repository at this point in the history
  • Loading branch information
coreyhulen authored and crspeller committed Aug 22, 2017
1 parent 9e8b3ff commit 6456441
Showing 1 changed file with 26 additions and 24 deletions.
50 changes: 26 additions & 24 deletions utils/utils.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,33 +122,35 @@ export function notifyMe(title, body, channel, teamId, duration, silent) {
if (Notification.permission === 'granted' || (Notification.permission === 'default' && !requestedNotificationPermission)) {
requestedNotificationPermission = true;

Notification.requestPermission((permission) => {
if (permission === 'granted') {
try {
var notification = new Notification(title, {body, tag: body, icon: icon50, requireInteraction: notificationDuration === 0, silent});
notification.onclick = () => {
window.focus();
if (channel && (channel.type === Constants.DM_CHANNEL || channel.type === Constants.GM_CHANNEL)) {
browserHistory.push(TeamStore.getCurrentTeamUrl() + '/channels/' + channel.name);
} else if (channel) {
browserHistory.push(TeamStore.getTeamUrl(teamId) + '/channels/' + channel.name);
} else if (teamId) {
browserHistory.push(TeamStore.getTeamUrl(teamId) + '/channels/town-square');
} else {
browserHistory.push(TeamStore.getCurrentTeamUrl() + '/channels/town-square');
if (typeof Notification.requestPermission === 'function') {
Notification.requestPermission((permission) => {
if (permission === 'granted') {
try {
var notification = new Notification(title, {body, tag: body, icon: icon50, requireInteraction: notificationDuration === 0, silent});
notification.onclick = () => {
window.focus();
if (channel && (channel.type === Constants.DM_CHANNEL || channel.type === Constants.GM_CHANNEL)) {
browserHistory.push(TeamStore.getCurrentTeamUrl() + '/channels/' + channel.name);
} else if (channel) {
browserHistory.push(TeamStore.getTeamUrl(teamId) + '/channels/' + channel.name);
} else if (teamId) {
browserHistory.push(TeamStore.getTeamUrl(teamId) + '/channels/town-square');
} else {
browserHistory.push(TeamStore.getCurrentTeamUrl() + '/channels/town-square');
}
};

if (notificationDuration > 0) {
setTimeout(() => {
notification.close();
}, notificationDuration);
}
};

if (notificationDuration > 0) {
setTimeout(() => {
notification.close();
}, notificationDuration);
} catch (e) {
console.error(e); //eslint-disable-line no-console
}
} catch (e) {
console.error(e); //eslint-disable-line no-console
}
}
});
});
}
}
}

Expand Down

0 comments on commit 6456441

Please sign in to comment.