summaryrefslogtreecommitdiff
path: root/lib/api
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2017-02-13 10:22:38 +0000
committerRémy Coutable <remy@rymai.me>2017-02-13 10:22:38 +0000
commit6a1b3ef73f57d58d159e343f79e1f74418c2f763 (patch)
tree6e7c0bb5efbe28acba6728132952538ea399779a /lib/api
parent59f44052d8753247a4a7435780fcb41b43e274ac (diff)
parent128b1eae092e4ee9384c99a4ba72b9122fc17e89 (diff)
downloadgitlab-ce-6a1b3ef73f57d58d159e343f79e1f74418c2f763.tar.gz
Merge branch 'zj-drop-ruby-21-tests' into 'master'
Update Rubocop to Ruby 2.3 See merge request !8994
Diffstat (limited to 'lib/api')
-rw-r--r--lib/api/branches.rb2
-rw-r--r--lib/api/entities.rb4
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 3a5819d1bab..2a071e649fa 100644
--- a/lib/api/entities.rb
+++ b/lib/api/entities.rb
@@ -380,9 +380,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