[Git][noosfero/noosfero][master] 2 commits: fixes creation of specific tasks in API

Victor Costa gitlab at mg.gitlab.com
Mon May 9 12:03:37 BRT 2016


Victor Costa pushed to branch master at Noosfero / noosfero


Commits:
a97d8f17 by Marcos Ronaldo at 2016-05-04T10:17:59-03:00
fixes creation of specific tasks in API

- - - - -
6fa81300 by Victor Costa at 2016-05-09T15:03:22+00:00
Merge branch 'fixes_tasks_api' into 'master'

fixes creation of specific tasks in API

API: Fixes task creation with specific type to also work on development environment.
In development with the current code, the task descendants are not loaded when the method post_task is called.

See merge request !893
- - - - -


1 changed file:

- lib/noosfero/api/helpers.rb


Changes:

=====================================
lib/noosfero/api/helpers.rb
=====================================
--- a/lib/noosfero/api/helpers.rb
+++ b/lib/noosfero/api/helpers.rb
@@ -99,7 +99,6 @@ require_relative '../../find_by_contents'
       end
 
       ARTICLE_TYPES = ['Article'] + Article.descendants.map{|a| a.to_s}
-      TASK_TYPES = ['Task'] + Task.descendants.map{|a| a.to_s}
 
       def find_article(articles, id)
         article = articles.find(id)
@@ -154,7 +153,7 @@ require_relative '../../find_by_contents'
 
       def post_task(asset, params)
         klass_type= params[:content_type].nil? ? 'Task' : params[:content_type]
-        return forbidden! unless TASK_TYPES.include?(klass_type)
+        return forbidden! unless klass_type.constantize <= Task
 
         task = klass_type.constantize.new(params[:task])
         task.requestor_id = current_person.id



View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/0b13c293bd3efef3e72d8130ad2cbebae526e624...6fa81300e41bc5bdd926ee5f7859346555bd8844
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20160509/0b6934a8/attachment-0001.html>


More information about the Noosfero-dev mailing list