Sha256: fa338a96e9f3c0c1fe6a589155f8bce19ea71251f968f0c09194e6803f015d2a

Contents?: true

Size: 685 Bytes

Versions: 25

Compression:

Stored size: 685 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Messaging
    # A class used to find the conversations a user is participating in.
    class UserConversations < Decidim::Query
      # Syntactic sugar to initialize the class and return the queried objects.
      #
      # user - a User that needs to find which processes can manage
      def self.for(user)
        new(user).query
      end

      def initialize(user)
        @user = user
      end

      def query
        Conversation
          .joins(:participations)
          .where(decidim_messaging_participations: { decidim_participant_id: user.id })
      end

      private

      attr_reader :user
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
decidim-core-0.27.2 app/queries/decidim/messaging/user_conversations.rb
decidim-core-0.27.1 app/queries/decidim/messaging/user_conversations.rb
decidim-core-0.27.0 app/queries/decidim/messaging/user_conversations.rb
decidim-core-0.27.0.rc2 app/queries/decidim/messaging/user_conversations.rb
decidim-core-0.27.0.rc1 app/queries/decidim/messaging/user_conversations.rb