Sha256: da77d2e8240a7348f9851d67c650a5b14b20468e09a5674d7d73615cc4104826

Contents?: true

Size: 952 Bytes

Versions: 24

Compression:

Stored size: 952 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module UserGroups
    # Use this class to find the the members of the given user group with the
    # "member" role. It returns memberships.
    class MemberMemberships < Rectify::Query
      # Syntactic sugar to initialize the class and return the queried objects.
      #
      # user_group - a UserGroup that needs to find its member users
      def self.for(user_group)
        new(user_group).query
      end

      # Initializes the class.
      #
      # user_group - a UserGroup that needs to find its member users
      def initialize(user_group)
        @user_group = user_group
      end

      # Finds the member users of the user group.
      #
      # Returns an ActiveRecord::Relation.
      def query
        user_group
          .non_deleted_memberships
          .includes(:user)
          .where(role: :member)
      end

      private

      attr_reader :user_group
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
decidim-core-0.26.10 app/queries/decidim/user_groups/member_memberships.rb
decidim-core-0.26.9 app/queries/decidim/user_groups/member_memberships.rb
decidim-core-0.26.8 app/queries/decidim/user_groups/member_memberships.rb
decidim-core-0.26.7 app/queries/decidim/user_groups/member_memberships.rb
decidim-core-0.26.5 app/queries/decidim/user_groups/member_memberships.rb
decidim-core-0.26.4 app/queries/decidim/user_groups/member_memberships.rb
decidim-core-0.26.3 app/queries/decidim/user_groups/member_memberships.rb
decidim-core-0.26.2 app/queries/decidim/user_groups/member_memberships.rb
decidim-core-0.26.1 app/queries/decidim/user_groups/member_memberships.rb
decidim-core-0.26.0 app/queries/decidim/user_groups/member_memberships.rb
decidim-core-0.26.0.rc2 app/queries/decidim/user_groups/member_memberships.rb
decidim-core-0.26.0.rc1 app/queries/decidim/user_groups/member_memberships.rb
decidim-core-0.25.2 app/queries/decidim/user_groups/member_memberships.rb
decidim-core-0.25.1 app/queries/decidim/user_groups/member_memberships.rb
decidim-core-0.25.0 app/queries/decidim/user_groups/member_memberships.rb
decidim-core-0.25.0.rc4 app/queries/decidim/user_groups/member_memberships.rb
decidim-core-0.25.0.rc3 app/queries/decidim/user_groups/member_memberships.rb
decidim-core-0.25.0.rc2 app/queries/decidim/user_groups/member_memberships.rb
decidim-core-0.25.0.rc1 app/queries/decidim/user_groups/member_memberships.rb
decidim-core-0.24.3 app/queries/decidim/user_groups/member_memberships.rb