diff options
author | Jacopo <beschi.jacopo@gmail.com> | 2018-07-27 22:49:49 +0300 |
---|---|---|
committer | Jacopo <beschi.jacopo@gmail.com> | 2018-07-30 19:19:57 +0300 |
commit | 5bab78950d652ce15d87772ae2857f370fd926a4 (patch) | |
tree | 64f6e3e197bda5c502a8c6bd4f5c96ad12682f56 /lib | |
parent | 87f03f01735fb4b6dbef2e4bf625cf2546523a4e (diff) |
Improve error message when adding invalid user to a project
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/members.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/api/members.rb b/lib/api/members.rb index 3d2220fed96..d23dd834c69 100644 --- a/lib/api/members.rb +++ b/lib/api/members.rb @@ -75,7 +75,10 @@ module API member = source.members.find_by(user_id: params[:user_id]) conflict!('Member already exists') if member - member = source.add_user(params[:user_id], params[:access_level], current_user: current_user, expires_at: params[:expires_at]) + user = User.find_by_id(params[:user_id]) + not_found!('User') unless user + + member = source.add_user(user, params[:access_level], current_user: current_user, expires_at: params[:expires_at]) if !member not_allowed! # This currently can only be reached in EE |