Commit 6dfd88a145b7c7f9dc798d888a2aa4ad5c1c54b7
Exists in
spb-stable
and in
2 other branches
Merge branch 'fix-group-members-search' into 'master'
Fix group members search Postgres only. 500 error when try to search group members on `/groups/:group_id/members` page
Showing
3 changed files
with
15 additions
and
1 deletions
Show diff stats
app/controllers/groups_controller.rb
| @@ -68,7 +68,7 @@ class GroupsController < ApplicationController | @@ -68,7 +68,7 @@ class GroupsController < ApplicationController | ||
| 68 | @members = group.users_groups | 68 | @members = group.users_groups |
| 69 | 69 | ||
| 70 | if params[:search].present? | 70 | if params[:search].present? |
| 71 | - users = group.users.search(params[:search]) | 71 | + users = group.users.search(params[:search]).to_a |
| 72 | @members = @members.where(user_id: users) | 72 | @members = @members.where(user_id: users) |
| 73 | end | 73 | end |
| 74 | 74 |
features/group.feature
| @@ -113,3 +113,10 @@ Feature: Groups | @@ -113,3 +113,10 @@ Feature: Groups | ||
| 113 | Then I should see user "John Doe" in team list | 113 | Then I should see user "John Doe" in team list |
| 114 | Then I should see user "Mary Jane" in team list | 114 | Then I should see user "Mary Jane" in team list |
| 115 | Then I should not see the "Remove User From Group" button for "Mary Jane" | 115 | Then I should not see the "Remove User From Group" button for "Mary Jane" |
| 116 | + | ||
| 117 | + Scenario: Search member by name | ||
| 118 | + Given "Mary Jane" is guest of group "Guest" | ||
| 119 | + And I visit group "Guest" members page | ||
| 120 | + When I search for 'Mary' member | ||
| 121 | + Then I should see user "Mary Jane" in team list | ||
| 122 | + Then I should not see user "John Doe" in team list |
features/steps/group/group.rb
| @@ -157,6 +157,13 @@ class Groups < Spinach::FeatureSteps | @@ -157,6 +157,13 @@ class Groups < Spinach::FeatureSteps | ||
| 157 | # poltergeist always confirms popups. | 157 | # poltergeist always confirms popups. |
| 158 | end | 158 | end |
| 159 | 159 | ||
| 160 | + step 'I search for \'Mary\' member' do | ||
| 161 | + within '.member-search-form' do | ||
| 162 | + fill_in 'search', with: 'Mary' | ||
| 163 | + click_button 'Search' | ||
| 164 | + end | ||
| 165 | + end | ||
| 166 | + | ||
| 160 | protected | 167 | protected |
| 161 | 168 | ||
| 162 | def assigned_to_me key | 169 | def assigned_to_me key |