summaryrefslogtreecommitdiff
path: root/lib/api/entities.rb
diff options
context:
space:
mode:
authorGeorge Andrinopoulos <geoandri@gmail.com>2017-02-21 15:44:21 +0200
committerGeorge Andrinopoulos <geoandri@gmail.com>2017-02-21 15:45:10 +0200
commit85c87be361e804977e7924ea9e464d0752cd2f24 (patch)
tree8ec30c40977953b791f82a865372de02afcf847c /lib/api/entities.rb
parent9007a293a4af1872aa3ce2f0d613510f7839928f (diff)
downloadgitlab-ce-85c87be361e804977e7924ea9e464d0752cd2f24.tar.gz
Add spec for todo with target_type Commit
Diffstat (limited to 'lib/api/entities.rb')
-rw-r--r--lib/api/entities.rb7
1 files changed, 2 insertions, 5 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb
index 4484ea92d48..536d3ee49d4 100644
--- a/lib/api/entities.rb
+++ b/lib/api/entities.rb
@@ -397,11 +397,8 @@ module API
expose :target_type
expose :target do |todo, options|
- if todo.target_type == 'Commit'
- Entities.const_get('RepoCommit').represent(todo.target, options)
- else
- Entities.const_get(todo.target_type).represent(todo.target, options)
- end
+ target = todo.target_type == 'Commit' ? 'RepoCommit' : todo.target_type
+ Entities.const_get(target).represent(todo.target, options)
end
expose :target_url do |todo, options|