Class: Decidim::Messaging::UserConversations
- Inherits:
-
Rectify::Query
- Object
- Rectify::Query
- Decidim::Messaging::UserConversations
- Defined in:
- app/queries/decidim/messaging/user_conversations.rb
Overview
A class used to find the conversations a user is participating in.
Class Method Summary collapse
-
.for(user) ⇒ Object
Syntactic sugar to initialize the class and return the queried objects.
Instance Method Summary collapse
-
#initialize(user) ⇒ UserConversations
constructor
A new instance of UserConversations.
- #query ⇒ Object
Constructor Details
#initialize(user) ⇒ UserConversations
Returns a new instance of UserConversations.
14 15 16 |
# File 'app/queries/decidim/messaging/user_conversations.rb', line 14 def initialize(user) @user = user end |
Class Method Details
.for(user) ⇒ Object
Syntactic sugar to initialize the class and return the queried objects.
user - a User that needs to find which processes can manage
10 11 12 |
# File 'app/queries/decidim/messaging/user_conversations.rb', line 10 def self.for(user) new(user).query end |
Instance Method Details
#query ⇒ Object
18 19 20 21 22 |
# File 'app/queries/decidim/messaging/user_conversations.rb', line 18 def query Conversation .joins(:participations) .where(decidim_messaging_participations: { decidim_participant_id: user.id }) end |