diff options
author | zeripath <art27@cantab.net> | 2021-04-04 22:37:50 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-04 22:37:50 +0100 |
commit | 48ef04ee56272da4c8c8fd96b8af13fe82cd8e37 (patch) | |
tree | bba3ddc221666c39818f6ffa5ed2be9f6ae403e8 /web_src/js/features/notification.js | |
parent | f2715b8e294d53a54bb71876c74a7fbec5b41937 (diff) | |
download | gitea-48ef04ee56272da4c8c8fd96b8af13fe82cd8e37.tar.gz gitea-48ef04ee56272da4c8c8fd96b8af13fe82cd8e37.zip |
Drop the event source if we are unauthorized (#15275)
A previous commit that sent unauthorized if the user is unauthorized
simply leads to the repeated reopening of the eventsource. #
This PR changes the event returned to tell the client to close the
eventsource and thus prevents the repeated reopening.
Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'web_src/js/features/notification.js')
-rw-r--r-- | web_src/js/features/notification.js | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/web_src/js/features/notification.js b/web_src/js/features/notification.js index a0793d2286..fca1ddc543 100644 --- a/web_src/js/features/notification.js +++ b/web_src/js/features/notification.js @@ -74,6 +74,11 @@ export async function initNotificationCount() { }); worker.port.close(); window.location.href = AppSubUrl; + } else if (event.data.type === 'close') { + worker.port.postMessage({ + type: 'close', + }); + worker.port.close(); } }); worker.port.addEventListener('error', (e) => { |