mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-11 00:15:46 +01:00
altering ajaxify abort behaviour to look for null instead of empty string, and triggering ajaxify.end when abort occurs
This commit is contained in:
@@ -67,7 +67,8 @@ $(document).ready(function() {
|
||||
url = ajaxify.start(url);
|
||||
|
||||
// If any listeners alter url and set it to an empty string, abort the ajaxification
|
||||
if (url === '') {
|
||||
if (url === null) {
|
||||
$(window).trigger('action:ajaxify.end', {url: url, tpl_url: ajaxify.data.template.name, title: ajaxify.data.title});
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,11 +50,13 @@ define('forum/footer', ['notifications', 'chat', 'components', 'translator'], fu
|
||||
}
|
||||
|
||||
$(window).on('action:ajaxify.end', function(ev, data) {
|
||||
if (data.url) {
|
||||
var tid = data.url.match(/^topic\/(\d+)/);
|
||||
|
||||
if (tid && tid[1]) {
|
||||
delete unreadTopics[tid[1]];
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('event:new_post', onNewPost);
|
||||
|
||||
@@ -31,7 +31,7 @@ define('forum/topic', [
|
||||
$(window).off('keydown', onKeyDown);
|
||||
}
|
||||
|
||||
if (!data.url.startsWith('topic/')) {
|
||||
if (data.url && !data.url.startsWith('topic/')) {
|
||||
require(['search'], function(search) {
|
||||
if (search.topicDOM.active) {
|
||||
search.topicDOM.end();
|
||||
|
||||
Reference in New Issue
Block a user