[Git][noosfero/noosfero][master] 3 commits: avoid pg search plugin to broke invite members
Leandro Nunes
gitlab at mg.gitlab.com
Thu Aug 4 19:24:17 BRT 2016
Leandro Nunes pushed to branch master at Noosfero / noosfero
Commits:
36202783 by Leandro Nunes dos Santos at 2016-08-04T18:28:50-03:00
avoid pg search plugin to broke invite members
- - - - -
66edd24f by Leandro Nunes dos Santos at 2016-08-04T19:23:27-03:00
remove unecessary assertions
- - - - -
038c04ea by Leandro Nunes at 2016-08-04T22:24:04+00:00
Merge branch 'fix_invite_friend_to_community' into 'master'
avoid pg search plugin to broke invite members
See merge request !999
- - - - -
2 changed files:
- app/controllers/public/invite_controller.rb
- + plugins/pg_search/test/functional/invite_controller_test.rb
Changes:
=====================================
app/controllers/public/invite_controller.rb
=====================================
--- a/app/controllers/public/invite_controller.rb
+++ b/app/controllers/public/invite_controller.rb
@@ -82,6 +82,8 @@ class InviteController < PublicController
scope = profile.invite_friends_only ? user.friends : environment.people
scope = scope.not_members_of(profile) if profile.organization?
scope = scope.not_friends_of(profile) if profile.person?
+ scope = scope.distinct(false).group("profiles.id")
+
results = find_by_contents(:people, environment, scope, params['q'], {:page => 1}, {:joins => :user})[:results]
render :text => prepare_to_token_input(results).to_json
end
=====================================
plugins/pg_search/test/functional/invite_controller_test.rb
=====================================
--- /dev/null
+++ b/plugins/pg_search/test/functional/invite_controller_test.rb
@@ -0,0 +1,22 @@
+require "test_helper"
+
+class InviteControllerTest < ActionController::TestCase
+
+ should 'list people available to invite' do
+ env = Environment.default
+ env.enable_plugin(PgSearchPlugin)
+ profile = create_user('profile').person
+ login_as(profile.identifier)
+
+ community = fast_create(Community, :name => 'Testing community 1', :identifier => 'testcommunity1', :environment_id => env)
+ community.add_admin profile
+
+ p1 = fast_create(Person, :identifier => 'someone')
+ p2 = fast_create(Person, :identifier => 'someother')
+
+ assert_nothing_raised do
+ get :search, :profile => community.identifier, :q => 'some'
+ end
+ end
+
+end
View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/02903b02b2290e7a7af8fb0fd253fc4dbe1465ad...038c04ea414fa21e63c4709259cf269c65d2793f
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20160804/c7ca3f92/attachment-0001.html>
More information about the Noosfero-dev
mailing list