Remove route which became obsolete because of the replaced user autocompleter

pull/7521/head
Henriette Dinger 5 years ago
parent 9c2a920955
commit 7d027b64b3
  1. 7
      app/controllers/groups_controller.rb
  2. 1
      config/routes.rb
  3. 6
      spec/routing/groups_spec.rb
  4. 9
      spec_legacy/functional/groups_controller_spec.rb

@ -31,7 +31,7 @@ class GroupsController < ApplicationController
layout 'admin'
before_action :require_admin
before_action :find_group, only: [:destroy, :autocomplete_for_user,
before_action :find_group, only: [:destroy,
:show, :create_memberships, :destroy_membership,
:edit_membership]
@ -136,11 +136,6 @@ class GroupsController < ApplicationController
redirect_to controller: '/groups', action: 'edit', id: @group, tab: 'users'
end
def autocomplete_for_user
@users = User.active.not_in_group(@group).like(params[:q]).limit(100)
render layout: false
end
def create_memberships
membership_params = permitted_params.group_membership
membership_id = membership_params[:membership_id]

@ -357,7 +357,6 @@ OpenProject::Application.routes.draw do
resources :groups do
member do
get :autocomplete_for_user
# this should be put into it's own resource
match '/members' => 'groups#add_users', via: :post, as: 'members_of'
match '/members/:user_id' => 'groups#remove_user', via: :delete, as: 'member_of'

@ -68,12 +68,6 @@ describe 'groups routes', type: :routing do
id: '4')
}
it {
is_expected.to route(:get, '/admin/groups/4/autocomplete_for_user').to(controller: 'groups',
action: 'autocomplete_for_user',
id: '4')
}
it {
is_expected.to route(:post, '/admin/groups/4/members').to(controller: 'groups',
action: 'add_users',

@ -110,13 +110,4 @@ describe GroupsController, type: :controller do
delete :destroy_membership, params: { id: 10, membership_id: 6 }
end
end
it 'should autocomplete for user' do
get :autocomplete_for_user, params: { id: 10, q: 'mis' }
assert_response :success
users = assigns(:users)
refute_nil users
assert users.any?
assert !users.include?(Group.find(10).users.first)
end
end

Loading…
Cancel
Save