mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-31 11:50:08 +01:00
fix: #13939, dont append / if url is empty
dont call updateHistory twice on page load
This commit is contained in:
@@ -200,7 +200,7 @@ ajaxify.widgets = { render: render };
|
||||
if (window.history && window.history.pushState) {
|
||||
window.history[!quiet ? 'pushState' : 'replaceState']({
|
||||
url: url,
|
||||
}, url, config.relative_path + '/' + url);
|
||||
}, '', config.relative_path + (url ? '/' + url : ''));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -557,10 +557,11 @@ ajaxify.widgets = { render: render };
|
||||
$(document).ready(function () {
|
||||
window.addEventListener('popstate', (ev) => {
|
||||
if (ev !== null && ev.state) {
|
||||
if (ev.state.url === null && ev.state.returnPath !== undefined) {
|
||||
const { returnPath } = ev.state;
|
||||
if (ev.state.url === null && returnPath !== undefined) {
|
||||
window.history.replaceState({
|
||||
url: ev.state.returnPath,
|
||||
}, ev.state.returnPath, config.relative_path + '/' + ev.state.returnPath);
|
||||
url: returnPath,
|
||||
}, '', config.relative_path + (returnPath ? '/' + returnPath : ''));
|
||||
} else if (ev.state.url !== undefined) {
|
||||
ajaxify.handleTransientElements();
|
||||
ajaxify.go(ev.state.url, function () {
|
||||
|
||||
@@ -74,6 +74,7 @@ define('messages', ['bootbox', 'translator', 'storage', 'alerts', 'hooks'], func
|
||||
|
||||
function showQueryStringMessages() {
|
||||
const params = utils.params({ full: true });
|
||||
const originalQs = params.toString();
|
||||
showWelcomeMessage = params.has('loggedin');
|
||||
registerMessage = params.get('register');
|
||||
|
||||
@@ -102,7 +103,9 @@ define('messages', ['bootbox', 'translator', 'storage', 'alerts', 'hooks'], func
|
||||
}
|
||||
|
||||
const qs = params.toString();
|
||||
ajaxify.updateHistory(ajaxify.currentPage + (qs ? `?${qs}` : '') + document.location.hash, true);
|
||||
if (qs !== originalQs) {
|
||||
ajaxify.updateHistory(ajaxify.currentPage + (qs ? `?${qs}` : '') + document.location.hash, true);
|
||||
}
|
||||
}
|
||||
|
||||
messages.showInvalidSession = function () {
|
||||
|
||||
Reference in New Issue
Block a user