[Git][noosfero/noosfero][master] 2 commits: api: fix creation of specific article
Leandro Nunes
gitlab at mg.gitlab.com
Mon May 9 13:23:59 BRT 2016
Leandro Nunes pushed to branch master at Noosfero / noosfero
Commits:
c6d67b73 by Victor Costa at 2016-05-09T13:01:57-03:00
api: fix creation of specific article
- - - - -
a6d617ca by Leandro Nunes at 2016-05-09T16:23:52+00:00
Merge branch 'api-article-types' into 'master'
api: fix creation of specific article
See merge request !906
- - - - -
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
@@ -98,8 +98,6 @@ require_relative '../../find_by_contents'
end
end
- ARTICLE_TYPES = ['Article'] + Article.descendants.map{|a| a.to_s}
-
def find_article(articles, id)
article = articles.find(id)
article.display_to?(current_person) ? article : forbidden!
@@ -109,7 +107,7 @@ require_relative '../../find_by_contents'
return forbidden! unless current_person.can_post_content?(asset)
klass_type = params[:content_type] || params[:article].delete(:type) || TinyMceArticle.name
- return forbidden! unless ARTICLE_TYPES.include?(klass_type)
+ return forbidden! unless klass_type.constantize <= Article
article = klass_type.constantize.new(params[:article])
article.last_changed_by = current_person
View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/a3dea573a9463c22facd512d707b1b1428008f6a...a6d617ca01f094ca799a7281cf0f1fdc3013487b
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20160509/cb1c73b2/attachment-0001.html>
More information about the Noosfero-dev
mailing list