diff options
author | Z.J. van de Weg <git@zjvandeweg.nl> | 2017-02-07 15:16:46 +0100 |
---|---|---|
committer | Z.J. van de Weg <git@zjvandeweg.nl> | 2017-02-07 15:16:46 +0100 |
commit | 128b1eae092e4ee9384c99a4ba72b9122fc17e89 (patch) | |
tree | 8eab2084903f6455c40e969cbc3d8ef02582288e /lib/api | |
parent | 68db614d17c3ad984f7a5698d02475f71bde8941 (diff) | |
download | gitlab-ce-128b1eae092e4ee9384c99a4ba72b9122fc17e89.tar.gz |
Update Rubocop to ruby 2.3zj-drop-ruby-21-tests
Diffstat (limited to 'lib/api')
-rw-r--r-- | lib/api/branches.rb | 2 | ||||
-rw-r--r-- | lib/api/entities.rb | 4 |
2 files changed, 2 insertions, 4 deletions
diff --git a/lib/api/branches.rb b/lib/api/branches.rb index be659fa4a6a..9331be1f7de 100644 --- a/lib/api/branches.rb +++ b/lib/api/branches.rb @@ -84,7 +84,7 @@ module API branch = user_project.repository.find_branch(params[:branch]) not_found!("Branch") unless branch protected_branch = user_project.protected_branches.find_by(name: branch.name) - protected_branch.destroy if protected_branch + protected_branch&.destroy present branch, with: Entities::RepoBranch, project: user_project end diff --git a/lib/api/entities.rb b/lib/api/entities.rb index b1ead48caf7..bedcd503724 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -382,9 +382,7 @@ module API expose :author, using: Entities::UserBasic, if: ->(event, options) { event.author } expose :author_username do |event, options| - if event.author - event.author.username - end + event.author&.username end end |