forked from External/greenlight
		
	combine channels for meeting updates
This commit is contained in:
		@@ -2,17 +2,22 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  var initRooms = function() {
 | 
					  var initRooms = function() {
 | 
				
			||||||
    App.messages = App.cable.subscriptions.create({
 | 
					    App.messages = App.cable.subscriptions.create({
 | 
				
			||||||
      channel: 'ModeratorJoinsChannel',
 | 
					      channel: 'MeetingUpdatesChannel',
 | 
				
			||||||
      username: getRoomName()
 | 
					      username: getRoomName()
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      received: function(data) {
 | 
					      received: function(data) {
 | 
				
			||||||
 | 
					        if (data.action === 'moderator_joined') {
 | 
				
			||||||
          if (!Meeting.getInstance().getModJoined()) {
 | 
					          if (!Meeting.getInstance().getModJoined()) {
 | 
				
			||||||
            Meeting.getInstance().setModJoined(true);
 | 
					            Meeting.getInstance().setModJoined(true);
 | 
				
			||||||
            if (Meeting.getInstance().getWaitingForMod()) {
 | 
					            if (Meeting.getInstance().getWaitingForMod()) {
 | 
				
			||||||
              loopJoin();
 | 
					              loopJoin();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
 | 
					          else if (data.action === 'meeting_ended') {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
							
								
								
									
										5
									
								
								app/channels/meeting_updates_channel.rb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								app/channels/meeting_updates_channel.rb
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,5 @@
 | 
				
			|||||||
 | 
					class MeetingUpdatesChannel < ApplicationCable::Channel
 | 
				
			||||||
 | 
					  def subscribed
 | 
				
			||||||
 | 
					    stream_from "#{params[:username]}_meeting_updates_channel"
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
@@ -1,5 +0,0 @@
 | 
				
			|||||||
class ModeratorJoinsChannel < ApplicationCable::Channel
 | 
					 | 
				
			||||||
  def subscribed
 | 
					 | 
				
			||||||
    stream_from "moderator_#{params[:username]}_join_channel"
 | 
					 | 
				
			||||||
  end
 | 
					 | 
				
			||||||
end
 | 
					 | 
				
			||||||
@@ -29,8 +29,9 @@ class BbbController < ApplicationController
 | 
				
			|||||||
      )
 | 
					      )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      if bbb_res[:returncode] && current_user && current_user == user
 | 
					      if bbb_res[:returncode] && current_user && current_user == user
 | 
				
			||||||
        ActionCable.server.broadcast "moderator_#{user.username}_join_channel",
 | 
					        ActionCable.server.broadcast "#{user.username}_meeting_updates_channel",
 | 
				
			||||||
          moderator: "joined"
 | 
					          action: 'moderator_joined',
 | 
				
			||||||
 | 
					          moderator: 'joined'
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      render_bbb_response bbb_res, bbb_res[:response]
 | 
					      render_bbb_response bbb_res, bbb_res[:response]
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user