forked from External/greenlight
		
	fix waiting to join retry logic
This commit is contained in:
		@@ -10,7 +10,9 @@ $(document).on("turbolinks:load", function(){
 | 
				
			|||||||
      uid: $(".background").attr("room")
 | 
					      uid: $(".background").attr("room")
 | 
				
			||||||
    }, {
 | 
					    }, {
 | 
				
			||||||
      received: function(data){
 | 
					      received: function(data){
 | 
				
			||||||
        if(data.action = "started"){ request_to_join_meeting(); }
 | 
					        if(data.action = "started"){
 | 
				
			||||||
 | 
					          request_to_join_meeting();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
@@ -29,8 +31,8 @@ var request_to_join_meeting = function(){
 | 
				
			|||||||
      'Content-Type': 'application/x-www-form-urlencoded',
 | 
					      'Content-Type': 'application/x-www-form-urlencoded',
 | 
				
			||||||
      'X-CSRF-Token': $('meta[name="csrf-token"]').attr('content')
 | 
					      'X-CSRF-Token': $('meta[name="csrf-token"]').attr('content')
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    error: function(){
 | 
					    success: function(){
 | 
				
			||||||
      // The meeting is still booting (going slowly), retry shortly.
 | 
					      // Enqueue another trial just incase they didn't actually join.
 | 
				
			||||||
      if(join_attempts < 4){ setTimeout(request_to_join_meeting, 10000); }
 | 
					      if(join_attempts < 4){ setTimeout(request_to_join_meeting, 10000); }
 | 
				
			||||||
      join_attempts++;
 | 
					      join_attempts++;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -17,7 +17,7 @@ class SessionsController < ApplicationController
 | 
				
			|||||||
  # POST /users/login
 | 
					  # POST /users/login
 | 
				
			||||||
  def create
 | 
					  def create
 | 
				
			||||||
    user = User.find_by(email: session_params[:email])
 | 
					    user = User.find_by(email: session_params[:email])
 | 
				
			||||||
    if user&.authenticate(session_params[:password])
 | 
					    if user.try(:authenticate, session_params[:password])
 | 
				
			||||||
      login(user)
 | 
					      login(user)
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
      redirect_to root_path, notice: LOGIN_FAILED
 | 
					      redirect_to root_path, notice: LOGIN_FAILED
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user