diff options
author | zeripath <art27@cantab.net> | 2020-07-04 15:01:25 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-04 10:01:25 -0400 |
commit | 60cb9fe44878f31e40bac7a9b64a77a9cffdc9f6 (patch) | |
tree | ff4d3dd35949419dfa7db90b7f0eef51ea16a556 /web_src/js/features/notification.js | |
parent | 510e4bd245719d08ce9832fd705a478ea151f1f6 (diff) | |
download | gitea-60cb9fe44878f31e40bac7a9b64a77a9cffdc9f6.tar.gz gitea-60cb9fe44878f31e40bac7a9b64a77a9cffdc9f6.zip |
Bugfix for shared event source (#12129)
For some reason our eslint configuration is not working correctly
and a bug has become apparent when trying to backport this to 1.12.
Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Diffstat (limited to 'web_src/js/features/notification.js')
-rw-r--r-- | web_src/js/features/notification.js | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/web_src/js/features/notification.js b/web_src/js/features/notification.js index 2b7fc45237..aa1b48d183 100644 --- a/web_src/js/features/notification.js +++ b/web_src/js/features/notification.js @@ -57,19 +57,17 @@ export async function initNotificationCount() { type: 'start', url: `${window.location.origin}${AppSubUrl}/user/events`, }); - worker.port.addEventListener('message', (e) => { - if (!e.data || !e.data.type) { - console.error(e); + worker.port.addEventListener('message', (event) => { + if (!event.data || !event.data.type) { + console.error(event); return; } if (event.data.type === 'notification-count') { - receiveUpdateCount(e.data); - return; + receiveUpdateCount(event.data); } else if (event.data.type === 'error') { - console.error(e.data); - return; + console.error(event.data); } else if (event.data.type === 'logout') { - if (e.data !== 'here') { + if (event.data !== 'here') { return; } worker.port.postMessage({ @@ -77,9 +75,6 @@ export async function initNotificationCount() { }); worker.port.close(); window.location.href = AppSubUrl; - return; - } else { - return; } }); worker.port.addEventListener('error', (e) => { |