Commit a3dea573a9463c22facd512d707b1b1428008f6a
Exists in
staging
and in
30 other branches
Merge remote-tracking branch 'origin/master'
Showing
1 changed file
with
1 additions
and
2 deletions
Show diff stats
lib/noosfero/api/helpers.rb
@@ -99,7 +99,6 @@ require_relative '../../find_by_contents' | @@ -99,7 +99,6 @@ require_relative '../../find_by_contents' | ||
99 | end | 99 | end |
100 | 100 | ||
101 | ARTICLE_TYPES = ['Article'] + Article.descendants.map{|a| a.to_s} | 101 | ARTICLE_TYPES = ['Article'] + Article.descendants.map{|a| a.to_s} |
102 | - TASK_TYPES = ['Task'] + Task.descendants.map{|a| a.to_s} | ||
103 | 102 | ||
104 | def find_article(articles, id) | 103 | def find_article(articles, id) |
105 | article = articles.find(id) | 104 | article = articles.find(id) |
@@ -154,7 +153,7 @@ require_relative '../../find_by_contents' | @@ -154,7 +153,7 @@ require_relative '../../find_by_contents' | ||
154 | 153 | ||
155 | def post_task(asset, params) | 154 | def post_task(asset, params) |
156 | klass_type= params[:content_type].nil? ? 'Task' : params[:content_type] | 155 | klass_type= params[:content_type].nil? ? 'Task' : params[:content_type] |
157 | - return forbidden! unless TASK_TYPES.include?(klass_type) | 156 | + return forbidden! unless klass_type.constantize <= Task |
158 | 157 | ||
159 | task = klass_type.constantize.new(params[:task]) | 158 | task = klass_type.constantize.new(params[:task]) |
160 | task.requestor_id = current_person.id | 159 | task.requestor_id = current_person.id |