Add participants to community

This commit is contained in:
taitus
2017-08-07 16:39:45 +02:00
parent bc95b6f28d
commit 08f58b845d
3 changed files with 12 additions and 1 deletions

View File

@@ -313,6 +313,11 @@ class User < ActiveRecord::Base
follows.map{|follow| follow.followable.tags.map(&:name)}.flatten.compact.uniq
end
def self.community_participants(community)
topics_ids = community.topics.pluck(:id)
User.joins(:comments).where("comments.commentable_id IN (?) and comments.commentable_type = 'Topic'", topics_ids)
end
private
def clean_document_number

View File

@@ -20,3 +20,10 @@
<%= link_to t("topic.new"), new_community_topic_path(@community.id), class: 'button expanded' %>
</div>
</div>
<div class="">
Participantes
<% User.community_participants(@community).each do |participant| %>
<%= link_to participant.name, user_path(participant)%>
<% end %>
</div>

View File

@@ -6,7 +6,6 @@ Comunidad: <%= @community.proposal.title %>
<div class="tabs-content" data-tabs-content="proposals-tabs" role="tablist">
<%= render "topics/filter_subnav" %>
<%#= render "proposals/notifications" %>
<div class="tabs-panel is-active" id="tab-comments">
<%= render "topics/comments" %>