Sha256: 4f01308c10561fcd7eeba2940e2b6570d007d239fd97c97abdbf848667eb123a

Contents?: true

Size: 555 Bytes

Versions: 25

Compression:

Stored size: 555 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Initiatives
    # This service scopes the meeting searches with parameters that cannot be
    # passed from the user interface.
    class InitiativeSearch < ResourceSearch
      attr_reader :author

      def build(params)
        return super if search_context == :admin

        @author = params[:author]

        if params[:author] == "myself" && user
          add_scope(:authored_by, user)
        else
          add_scope(:published, nil)
        end

        super
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

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