Skip to content

Node.js based forum software built for the modern web

return roomId in optional callback when opening new chat

psychobunny59bd1d71f4a1
diff --git a/public/src/app.js b/public/src/app.js
index a23125d5c4..66257e7980 100644
--- a/public/src/app.js
+++ b/public/src/app.js
@@ -287,7 +287,8 @@ app.cacheBuster = null;
});
};
- app.newChat = function (touid) {
+ app.newChat = function (touid, callback) {
+ callback = callback || function() {};
if (!app.user.uid) {
return app.alertError('[[error:not-logged-in]]');
}
@@ -296,11 +297,14 @@ app.cacheBuster = null;
if (err) {
return app.alertError(err.message);
}
+
if (!ajaxify.currentPage.startsWith('chats')) {
app.openChat(roomId);
} else {
ajaxify.go('chats/' + roomId);
}
+
+ callback(false, roomId);
});
};