diff --git a/lib/travis/api/app/endpoint/authorization.rb b/lib/travis/api/app/endpoint/authorization.rb index 24fddbcd..5733959d 100644 --- a/lib/travis/api/app/endpoint/authorization.rb +++ b/lib/travis/api/app/endpoint/authorization.rb @@ -216,7 +216,10 @@ class Travis::Api::App def info(attributes = {}) info = data.to_hash.slice('name', 'login', 'gravatar_id') info.merge! attributes.stringify_keys - info['education'] = education + if Travis::Features.feature_active?(:education_data_sync) || + (user && Travis::Features.owner_active?(:education_data_sync, user)) + info['education'] = education + end info['github_id'] ||= data['id'] info end diff --git a/spec/unit/endpoint/authorization/user_manager_spec.rb b/spec/unit/endpoint/authorization/user_manager_spec.rb index 5e48ec0b..4b5b5c04 100644 --- a/spec/unit/endpoint/authorization/user_manager_spec.rb +++ b/spec/unit/endpoint/authorization/user_manager_spec.rb @@ -3,6 +3,10 @@ require 'spec_helper' describe Travis::Api::App::Endpoint::Authorization::UserManager do let(:manager) { described_class.new(data, 'abc123') } + before do + Travis::Features.enable_for_all(:education_data_sync) + end + describe '#info' do let(:data) { {