Sha256: 912dc7068a0bcd55311f82756e97c603d860034d56ee753682c47a2c2866c92e

Contents?: true

Size: 528 Bytes

Versions: 17

Compression:

Stored size: 528 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module ParticipatoryProcesses
    # This query class filters participatory processes given a current_user.
    class VisibleParticipatoryProcesses < Rectify::Query
      def initialize(current_user)
        @current_user = current_user
      end

      def query
        processes = Decidim::ParticipatoryProcess.all

        if @current_user
          processes.visible_for(@current_user.id)
        else
          processes.public_spaces
        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
decidim-participatory_processes-0.15.2 app/queries/decidim/participatory_processes/visible_participatory_processes.rb
decidim-participatory_processes-0.15.1 app/queries/decidim/participatory_processes/visible_participatory_processes.rb
decidim-participatory_processes-0.15.0 app/queries/decidim/participatory_processes/visible_participatory_processes.rb
decidim-participatory_processes-0.14.4 app/queries/decidim/participatory_processes/visible_participatory_processes.rb
decidim-participatory_processes-0.14.3 app/queries/decidim/participatory_processes/visible_participatory_processes.rb
decidim-participatory_processes-0.14.2 app/queries/decidim/participatory_processes/visible_participatory_processes.rb
decidim-participatory_processes-0.14.1 app/queries/decidim/participatory_processes/visible_participatory_processes.rb
decidim-participatory_processes-0.13.1 app/queries/decidim/participatory_processes/visible_participatory_processes.rb
decidim-participatory_processes-0.12.2 app/queries/decidim/participatory_processes/visible_participatory_processes.rb
decidim-participatory_processes-0.13.0 app/queries/decidim/participatory_processes/visible_participatory_processes.rb
decidim-participatory_processes-0.12.1 app/queries/decidim/participatory_processes/visible_participatory_processes.rb
decidim-participatory_processes-0.13.0.pre1 app/queries/decidim/participatory_processes/visible_participatory_processes.rb
decidim-participatory_processes-0.12.0 app/queries/decidim/participatory_processes/visible_participatory_processes.rb
decidim-participatory_processes-0.11.2 app/queries/decidim/participatory_processes/visible_participatory_processes.rb
decidim-participatory_processes-0.12.0.pre app/queries/decidim/participatory_processes/visible_participatory_processes.rb
decidim-participatory_processes-0.11.1 app/queries/decidim/participatory_processes/visible_participatory_processes.rb
decidim-participatory_processes-0.11.0.pre1 app/queries/decidim/participatory_processes/visible_participatory_processes.rb