Sha256: 9a4a1d5fd81a950ba856f641d71d26eae3b3f5a7404b11829ff94988a94a60a5

Contents?: true

Size: 589 Bytes

Versions: 25

Compression:

Stored size: 589 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Debates
    # This service scopes the debate searches with parameters that cannot be
    # passed from the user interface.
    class DebateSearch < ResourceSearch
      attr_reader :activity

      def build(params)
        @activity = params[:activity]

        if params[:activity] && user
          case params[:activity]
          when "commented"
            add_scope(:commented_by, user)
          when "my_debates"
            add_scope(:authored_by, user)
          end
        end

        super
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
decidim-debates-0.29.1 app/services/decidim/debates/debate_search.rb
decidim-debates-0.28.4 app/services/decidim/debates/debate_search.rb
decidim-debates-0.27.9 app/services/decidim/debates/debate_search.rb
decidim-debates-0.29.0 app/services/decidim/debates/debate_search.rb
decidim-debates-0.28.3 app/services/decidim/debates/debate_search.rb
decidim-debates-0.27.8 app/services/decidim/debates/debate_search.rb
decidim-debates-0.29.0.rc4 app/services/decidim/debates/debate_search.rb
decidim-debates-0.29.0.rc3 app/services/decidim/debates/debate_search.rb
decidim-debates-0.29.0.rc2 app/services/decidim/debates/debate_search.rb
decidim-debates-0.29.0.rc1 app/services/decidim/debates/debate_search.rb
decidim-debates-0.28.2 app/services/decidim/debates/debate_search.rb
decidim-debates-0.27.7 app/services/decidim/debates/debate_search.rb
decidim-debates-0.28.1 app/services/decidim/debates/debate_search.rb
decidim-debates-0.27.6 app/services/decidim/debates/debate_search.rb
decidim-debates-0.28.0 app/services/decidim/debates/debate_search.rb
decidim-debates-0.27.5 app/services/decidim/debates/debate_search.rb
decidim-debates-0.28.0.rc5 app/services/decidim/debates/debate_search.rb
decidim-debates-0.28.0.rc4 app/services/decidim/debates/debate_search.rb
decidim-debates-0.27.4 app/services/decidim/debates/debate_search.rb
decidim-debates-0.27.3 app/services/decidim/debates/debate_search.rb