Taskme update

This commit is contained in:
Senad Uka
2020-06-30 05:08:23 +02:00
parent 1cd125382f
commit 71ad502cc1
210 changed files with 6316 additions and 766 deletions

View File

@@ -5,7 +5,7 @@ class ZoomNotificationsController < ApplicationController
skip_before_action :verify_authenticity_token
before_action :authorize_zoom
before_action :set_zoom_meeting, only: :create
before_action :set_zoom_meeting, only: [:create], if: :meeting_event?
def create
case notification_event
@@ -13,8 +13,17 @@ class ZoomNotificationsController < ApplicationController
@zoom_meeting.started!
when 'meeting.ended'
@zoom_meeting.ended!
when 'recording.completed'
recording = notification.dig(:payload, :object, :recording_files).first
AttachRecordingToZoomMeetingJob.perform_later(@zoom_meeting, recording, notification['download_token'])
when 'user.deleted'
zoom_user = ZoomUser.find_by(api_id: notification.dig(:payload, :object, :id))
if zoom_user.present?
zoom_user.api_id = nil
zoom_user.destroy
end
else
Rails.logger.info notification_type
Rails.logger.info notification_event
Rails.logger.info notification
end
@@ -23,16 +32,24 @@ class ZoomNotificationsController < ApplicationController
private
def notification
params.to_unsafe_h
end
def notification_event
params.dig(:event)
notification.dig(:event)
end
def notification_meeting_id
params.dig(:payload, :object, :id)
notification.dig(:payload, :object, :id)
end
def notification_host_id
params.dig(:payload, :object, :host_id)
notification.dig(:payload, :object, :host_id)
end
def meeting_event?
notification_event.split(".").first.to_s.in? %w(meeting recording)
end
def set_zoom_meeting