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.27.2 app/services/decidim/initiatives/initiative_search.rb
decidim-initiatives-0.27.1 app/services/decidim/initiatives/initiative_search.rb
decidim-initiatives-0.27.0 app/services/decidim/initiatives/initiative_search.rb
decidim-initiatives-0.27.0.rc2 app/services/decidim/initiatives/initiative_search.rb
decidim-initiatives-0.27.0.rc1 app/services/decidim/initiatives/initiative_search.rb