Sha256: 82ed86ddcf854635bfb24a4c3081c7341a49e9690265e7f6c8e2ede8cd8b09b0

Contents?: true

Size: 1.03 KB

Versions: 7

Compression:

Stored size: 1.03 KB

Contents

# frozen_string_literal: true

module Decidim
  module Meetings
    # Exposes the live event of the meeting
    class LiveEventsController < Decidim::Meetings::ApplicationController
      layout "decidim/meetings/layouts/live_event"

      include Decidim::Meetings::PollsResources

      helper_method :live_meeting_embed_code
      before_action :add_addtional_csp_directives, only: :show

      def show
        raise ActionController::RoutingError, "Not Found" unless meeting

        return if allowed_for_current_user?

        flash[:alert] = I18n.t("meeting.not_allowed", scope: "decidim.meetings")
        redirect_to(ResourceLocatorPresenter.new(meeting).index)
      end

      private

      def allowed_for_current_user?
        meeting.current_user_can_visit_meeting?(current_user) &&
          meeting.iframe_access_level_allowed_for_user?(current_user) &&
          meeting.live?
      end

      def live_meeting_embed_code
        MeetingIframeEmbedder.new(meeting.online_meeting_url).embed_code(request.host)
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
decidim-meetings-0.28.4 app/controllers/decidim/meetings/live_events_controller.rb
decidim-meetings-0.28.3 app/controllers/decidim/meetings/live_events_controller.rb
decidim-meetings-0.28.2 app/controllers/decidim/meetings/live_events_controller.rb
decidim-meetings-0.28.1 app/controllers/decidim/meetings/live_events_controller.rb
decidim-meetings-0.28.0 app/controllers/decidim/meetings/live_events_controller.rb
decidim-meetings-0.28.0.rc5 app/controllers/decidim/meetings/live_events_controller.rb
decidim-meetings-0.28.0.rc4 app/controllers/decidim/meetings/live_events_controller.rb