Proposal community
Poll participants become automatically members of the proposal community
This commit is contained in:
@@ -6,6 +6,7 @@ class Community < ActiveRecord::Base
|
||||
def participants
|
||||
users_participants = users_who_commented +
|
||||
users_who_topics_author +
|
||||
response_author_from_polls_for_proposal +
|
||||
author_from_community
|
||||
users_participants.uniq
|
||||
end
|
||||
@@ -31,4 +32,13 @@ class Community < ActiveRecord::Base
|
||||
from_proposal? ? User.where(id: proposal&.author_id) : User.where(id: investment&.author_id)
|
||||
end
|
||||
|
||||
def response_author_from_polls_for_proposal
|
||||
author_ids = []
|
||||
|
||||
Poll.where(related: proposal).each do |poll|
|
||||
author_ids += poll.questions.pluck(:author_id)
|
||||
end
|
||||
|
||||
User.by_authors(author_ids.uniq)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user