From 69a1c177a1f7f2f70d9953b008fe27d8cf9b3709 Mon Sep 17 00:00:00 2001 From: Yuya Ochiai Date: Wed, 23 Dec 2015 17:16:53 +0900 Subject: [PATCH] Switch to the team when notification is clicked --- src/browser/index.jsx | 7 ++++++- src/browser/webview/mattermost.js | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/browser/index.jsx b/src/browser/index.jsx index 6d1480a9..90dbb85f 100644 --- a/src/browser/index.jsx +++ b/src/browser/index.jsx @@ -72,7 +72,10 @@ var MainPage = React.createClass({ var handleUnreadCountChange = function(count) { thisObj.handleUnreadCountChange(index, count); }; - return () + var handleNotificationClick = function() { + thisObj.handleSelect(index); + } + return () }); return ( @@ -153,6 +156,8 @@ var MattermostView = React.createClass({ var unreadCount = event.args[0]; thisObj.handleUnreadCountChange(unreadCount); break; + case 'onNotificationClick': + thisObj.props.onNotificationClick(); } }); diff --git a/src/browser/webview/mattermost.js b/src/browser/webview/mattermost.js index 80543b3a..f56c6526 100644 --- a/src/browser/webview/mattermost.js +++ b/src/browser/webview/mattermost.js @@ -53,6 +53,7 @@ function overrideNotification() { Notification.prototype.__defineSetter__('onclick', function(callback) { this.notification.onclick = function() { electron.remote.getCurrentWindow().show(); + ipc.sendToHost('onNotificationClick'); callback(); }; });