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>
This commit is contained in:
zeripath 2020-07-04 15:01:25 +01:00 committed by GitHub
parent 510e4bd245
commit 60cb9fe448
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 17 deletions

View file

@ -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) => {