[Git][noosfero/noosfero][master] 2 commits: should not check requestor on approve article task

Victor Costa gitlab at mg.gitlab.com
Tue Aug 30 16:54:16 BRT 2016


Victor Costa pushed to branch master at Noosfero / noosfero


Commits:
e59ccc62 by Leandro Nunes dos Santos at 2016-08-30T16:13:02-03:00
should not check requestor on approve article task

- - - - -
a0f2837c by Victor Costa at 2016-08-30T19:53:56+00:00
Merge branch 'not_check_requestor' into 'master'

should not check requestor on approve article task

Today if a user is member of a community, make an article suggestion  and get out of community, Noosfero create an unprocessable task in community task management

See merge request !1011
- - - - -


2 changed files:

- app/models/approve_article.rb
- test/unit/approve_article_test.rb


Changes:

=====================================
app/models/approve_article.rb
=====================================
--- a/app/models/approve_article.rb
+++ b/app/models/approve_article.rb
@@ -9,9 +9,6 @@ class ApproveArticle < Task
       if target.person? && requestor != target
         self.errors.add(:requestor, _('You can not post articles to other users.'))
       end
-      if target.organization? && !target.members.include?(requestor) && target.environment.portal_community != target
-        self.errors.add(:requestor, _('Only members can post articles on communities.'))
-      end
     end
   end
 


=====================================
test/unit/approve_article_test.rb
=====================================
--- a/test/unit/approve_article_test.rb
+++ b/test/unit/approve_article_test.rb
@@ -462,7 +462,7 @@ class ApproveArticleTest < ActiveSupport::TestCase
     assert t2.invalid?(:requestor)
   end
 
-  should 'allow only members to be requestors when target is a community' do
+  should 'allow anyone to be requestors when target is a community' do
     community = fast_create(Community)
     member = fast_create(Person)
     community.add_member(member)
@@ -472,8 +472,7 @@ class ApproveArticleTest < ActiveSupport::TestCase
     t2 = ApproveArticle.new(:requestor => non_member, :target => community)
 
     assert t1.valid?
-    assert !t2.valid?
-    assert t2.invalid?(:requestor)
+    assert t2.valid?
   end
 
   should 'allow any user to be requestor whe the target is the portal community' do



View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/169bd9ef1a88929f2ce309b48e2d3c89893d913a...a0f2837c4da5ca30aff79898ea3a9aaa92287450
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20160830/f3689167/attachment-0001.html>


More information about the Noosfero-dev mailing list