From daf8f6f3cf76a9a34e3890ef631d35bb2d716935 Mon Sep 17 00:00:00 2001 From: James Allen Date: Tue, 31 May 2016 11:47:48 +0100 Subject: [PATCH] Refresh the page if the user is not logged in when joining a project --- .../coffee/ide/connection/ConnectionManager.coffee | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/services/web/public/coffee/ide/connection/ConnectionManager.coffee b/services/web/public/coffee/ide/connection/ConnectionManager.coffee index 1c6714f59a..f3d14a3e3d 100644 --- a/services/web/public/coffee/ide/connection/ConnectionManager.coffee +++ b/services/web/public/coffee/ide/connection/ConnectionManager.coffee @@ -103,6 +103,16 @@ define [], () -> @ide.socket.emit 'joinProject', { project_id: @ide.project_id }, (err, project, permissionsLevel, protocolVersion) => + if err? + if err.message == "not authorized" + window.location = "/login?redir=#{encodeURI(window.location.pathname)}" + else + @ide.socket.disconnect() + @ide.showGenericMessageModal("Something went wrong connecting", """ + Something went wrong connecting to your project. Please refresh is this continues to happen. + """) + return + if @$scope.protocolVersion? and @$scope.protocolVersion != protocolVersion location.reload(true)