mirror of https://github.com/go-gitea/gitea.git
Backport #30775 by wxiaoguang A quick fix for #30756 Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
parent
022eac4ac8
commit
2bedd16c14
|
@ -1,6 +1,7 @@
|
||||||
import $ from 'jquery';
|
import $ from 'jquery';
|
||||||
import {GET} from '../modules/fetch.js';
|
import {GET} from '../modules/fetch.js';
|
||||||
import {toggleElem} from '../utils/dom.js';
|
import {toggleElem} from '../utils/dom.js';
|
||||||
|
import {logoutFromWorker} from '../modules/worker.js';
|
||||||
|
|
||||||
const {appSubUrl, notificationSettings, assetVersionEncoded} = window.config;
|
const {appSubUrl, notificationSettings, assetVersionEncoded} = window.config;
|
||||||
let notificationSequenceNumber = 0;
|
let notificationSequenceNumber = 0;
|
||||||
|
@ -95,7 +96,7 @@ export function initNotificationCount() {
|
||||||
type: 'close',
|
type: 'close',
|
||||||
});
|
});
|
||||||
worker.port.close();
|
worker.port.close();
|
||||||
window.location.href = `${appSubUrl}/`;
|
logoutFromWorker();
|
||||||
} else if (event.data.type === 'close') {
|
} else if (event.data.type === 'close') {
|
||||||
worker.port.postMessage({
|
worker.port.postMessage({
|
||||||
type: 'close',
|
type: 'close',
|
||||||
|
|
|
@ -2,6 +2,7 @@ import prettyMilliseconds from 'pretty-ms';
|
||||||
import {createTippy} from '../modules/tippy.js';
|
import {createTippy} from '../modules/tippy.js';
|
||||||
import {GET} from '../modules/fetch.js';
|
import {GET} from '../modules/fetch.js';
|
||||||
import {hideElem, showElem} from '../utils/dom.js';
|
import {hideElem, showElem} from '../utils/dom.js';
|
||||||
|
import {logoutFromWorker} from '../modules/worker.js';
|
||||||
|
|
||||||
const {appSubUrl, notificationSettings, enableTimeTracking, assetVersionEncoded} = window.config;
|
const {appSubUrl, notificationSettings, enableTimeTracking, assetVersionEncoded} = window.config;
|
||||||
|
|
||||||
|
@ -75,7 +76,7 @@ export function initStopwatch() {
|
||||||
type: 'close',
|
type: 'close',
|
||||||
});
|
});
|
||||||
worker.port.close();
|
worker.port.close();
|
||||||
window.location.href = `${appSubUrl}/`;
|
logoutFromWorker();
|
||||||
} else if (event.data.type === 'close') {
|
} else if (event.data.type === 'close') {
|
||||||
worker.port.postMessage({
|
worker.port.postMessage({
|
||||||
type: 'close',
|
type: 'close',
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
import {sleep} from '../utils.js';
|
||||||
|
|
||||||
|
const {appSubUrl} = window.config;
|
||||||
|
|
||||||
|
export async function logoutFromWorker() {
|
||||||
|
// wait for a while because other requests (eg: logout) may be in the flight
|
||||||
|
await sleep(5000);
|
||||||
|
window.location.href = `${appSubUrl}/`;
|
||||||
|
}
|
Loading…
Reference in New Issue