summaryrefslogtreecommitdiffstats
path: root/webapp
diff options
context:
space:
mode:
authorCorey Hulen <corey@hulen.com>2017-08-22 15:10:31 -0700
committerChristopher Speller <crspeller@gmail.com>2017-08-22 15:10:31 -0700
commitf9632497a4ae7dc85a04274b2794ef8a52e99cb3 (patch)
treea7cd6712060e732e6fed8370b04be83a3d551030 /webapp
parent1f899c873e5eb8127b718cf5960b0a02d384365e (diff)
downloadchat-f9632497a4ae7dc85a04274b2794ef8a52e99cb3.tar.gz
chat-f9632497a4ae7dc85a04274b2794ef8a52e99cb3.tar.bz2
chat-f9632497a4ae7dc85a04274b2794ef8a52e99cb3.zip
Fixing logging errors for Franz (#7273)
Diffstat (limited to 'webapp')
-rw-r--r--webapp/utils/utils.jsx50
1 files changed, 26 insertions, 24 deletions
diff --git a/webapp/utils/utils.jsx b/webapp/utils/utils.jsx
index 0424792ad..2df4a753e 100644
--- a/webapp/utils/utils.jsx
+++ b/webapp/utils/utils.jsx
@@ -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
}
- }
- });
+ });
+ }
}
}