return roomId in optional callback when opening new chat

v1.18.x
psychobunny 9 years ago
parent 32dea338b0
commit 59bd1d71f4

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

Loading…
Cancel
Save