noosfero | Spread article on communities (#256)

Rodrigo Souto gitlab at mg.gitlab.com
Wed Apr 12 10:38:55 BRT 2017


New Issue was created.

Issue 256: https://gitlab.com/noosfero/noosfero/issues/256
Author:    Rodrigo Souto
Assignee:  Gabriel Silva

While spreading an article to communities you are part of, the search crashes when you have the sub_organizations plugin activated. The problem happens in this method:
```ruby
# app/controllers/my_profile/cms_controller.rb

  def search_communities_to_publish
    scope = user.memberships.distinct(false).group("profiles.id")
    render :text => find_by_contents(:profiles, environment, scope, params['q'], {:page => 1}, {:fields => ['name']})[:results].map {|community| {:id => community.id, :name => community.name} }.to_json
  end
```

The code `.distinct(false).group("profiles.id")` was introduced by commit 19ffa2d93 and altered by 4c3699b78 to avoid another crash that was happening with pg_search plugin.

So, with this code the method does not work with sub_organizations plugin enabled (it might have some relation with pg_search being enabled as well, did not test it) and without it, the method does not work with pg_search plugin enabled.

We need to find the proper way to solve this problem.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20170412/e798670d/attachment-0001.html>


More information about the Noosfero-dev mailing list