pilot/lib/pilot/tester_manager.rb in fastlane-2.52.0.beta.20170808010002 vs pilot/lib/pilot/tester_manager.rb in fastlane-2.52.0.beta.20170809010003
- old
+ new
@@ -102,11 +102,12 @@
end
nil
end
def find_app_tester(email: nil, app: nil)
- current_user = Spaceship::Members.find(Spaceship::Tunes.client.user)
+ current_user = find_current_user
+
if current_user.admin?
tester = Spaceship::Tunes::Tester::Internal.find(email)
tester ||= Spaceship::Tunes::Tester::External.find(email)
elsif current_user.app_manager?
unless app
@@ -124,11 +125,22 @@
end
return tester
end
+ def find_current_user
+ current_user_email = Spaceship::Tunes.client.user_email
+ current_user_apple_id = Spaceship::Tunes.client.user
+
+ current_user = Spaceship::Members.find(current_user_email)
+ unless current_user
+ UI.user_error!("Unable to find a member for AppleID: #{current_user_apple_id}, email: #{current_user_email}")
+ end
+ return current_user
+ end
+
def create_tester(email: nil, first_name: nil, last_name: nil, app: nil)
- current_user = Spaceship::Members.find(Spaceship::Tunes.client.user)
+ current_user = find_current_user
if current_user.admin?
tester = Spaceship::Tunes::Tester::External.create!(email: email,
first_name: first_name,
last_name: last_name)
UI.success("Successfully added tester: #{email} to your account")