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.29.1 app/queries/decidim/messaging/user_conversations.rb
decidim-core-0.28.4 app/queries/decidim/messaging/user_conversations.rb
decidim-core-0.27.9 app/queries/decidim/messaging/user_conversations.rb
decidim-core-0.29.0 app/queries/decidim/messaging/user_conversations.rb
decidim-core-0.28.3 app/queries/decidim/messaging/user_conversations.rb
decidim-core-0.27.8 app/queries/decidim/messaging/user_conversations.rb
decidim-core-0.29.0.rc4 app/queries/decidim/messaging/user_conversations.rb
decidim-core-0.29.0.rc3 app/queries/decidim/messaging/user_conversations.rb
decidim-core-0.29.0.rc2 app/queries/decidim/messaging/user_conversations.rb
decidim-core-0.29.0.rc1 app/queries/decidim/messaging/user_conversations.rb
decidim-core-0.28.2 app/queries/decidim/messaging/user_conversations.rb
decidim-core-0.27.7 app/queries/decidim/messaging/user_conversations.rb
decidim-core-0.28.1 app/queries/decidim/messaging/user_conversations.rb
decidim-core-0.27.6 app/queries/decidim/messaging/user_conversations.rb
decidim-core-0.28.0 app/queries/decidim/messaging/user_conversations.rb
decidim-core-0.27.5 app/queries/decidim/messaging/user_conversations.rb
decidim-core-0.28.0.rc5 app/queries/decidim/messaging/user_conversations.rb
decidim-core-0.28.0.rc4 app/queries/decidim/messaging/user_conversations.rb
decidim-core-0.27.4 app/queries/decidim/messaging/user_conversations.rb
decidim-core-0.27.3 app/queries/decidim/messaging/user_conversations.rb