diff options
author | Robert Speicher <robert@gitlab.com> | 2018-08-02 21:00:13 +0000 |
---|---|---|
committer | Bob Van Landuyt <bob@vanlanduyt.co> | 2018-08-03 09:40:56 +0200 |
commit | d0f2edb9b5efda2d2273b8cd9d710d7a5f4cd837 (patch) | |
tree | 50ed0f8c4bdcd90766890ae21257810073cd2398 | |
parent | 83d914dc1a7d5af858f8b31c33e4939f8a49394d (diff) | |
download | gitlab-ce-d0f2edb9b5efda2d2273b8cd9d710d7a5f4cd837.tar.gz |
Merge branch 'sh-fix-failing-deploy-token-clones' into 'master'
Fix failing 500 errors when deploy tokens are used to clone
Closes gitlab-ee#7080
See merge request gitlab-org/gitlab-ce!20993
-rw-r--r-- | app/services/users/activity_service.rb | 1 | ||||
-rw-r--r-- | spec/services/users/activity_service_spec.rb | 12 |
2 files changed, 13 insertions, 0 deletions
diff --git a/app/services/users/activity_service.rb b/app/services/users/activity_service.rb index 822df6c646a..db03ba8756f 100644 --- a/app/services/users/activity_service.rb +++ b/app/services/users/activity_service.rb @@ -11,6 +11,7 @@ module Users author.user end + @user = nil unless @user.is_a?(User) @activity = activity end diff --git a/spec/services/users/activity_service_spec.rb b/spec/services/users/activity_service_spec.rb index f20849e6924..719b4adf212 100644 --- a/spec/services/users/activity_service_spec.rb +++ b/spec/services/users/activity_service_spec.rb @@ -28,6 +28,18 @@ describe Users::ActivityService do end end + context 'when a bad object is passed' do + let(:fake_object) { double(username: 'hello') } + + it 'does not record activity' do + service = described_class.new(fake_object, 'pull') + + expect(service).not_to receive(:record_activity) + + service.execute + end + end + context 'when last activity is today' do let(:last_activity_on) { Date.today } |