Skip to content

Validate user id for users select autcomplete

username-removed-444 requested to merge dz-fix-user-select into master

What does this MR do?

Adds digit validation to user_id when build user autocomplete URL for select2.

Why was this MR needed?

To prevent building invalid URL for non existing users like GET "/autocomplete/users/whatever@example.com.json".

As result it fixes failing test:

Feature: Admin Groups

  Scenario: Invite user to a group by e-mail
    ✔  Given I sign in as an admin                                                             # features/steps/shared/authentication.rb:11
    ✔  And I have group with projects                                                          # features/steps/admin/groups.rb:17
    ✔  And User "John Doe" exists                                                              # features/steps/shared/user.rb:4
    ✔  And I visit admin groups page                                                           # features/steps/shared/paths.rb:194
    ✔  When I visit admin group page                                                           # features/steps/admin/groups.rb:9
    ✔  When I select user "johndoe@gitlab.com" from user list as "Reporter"                    # features/steps/admin/groups.rb:48
    ✔  Then I should see "johndoe@gitlab.com" in team list in every project as "Reporter"      # features/steps/admin/groups.rb:63
/Users/dzaporozhets/.rvm/gems/ruby-2.3.1/gems/actionpack-4.2.7.1/lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call': No route matches [GET] "/autocomplete/users/johndoe@gitlab.com.json" (ActionController::RoutingError)

Merge request reports