Commit a0f2837c4da5ca30aff79898ea3a9aaa92287450

Authored by Victor Costa
2 parents 169bd9ef e59ccc62

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
app/models/approve_article.rb
@@ -9,9 +9,6 @@ class ApproveArticle < Task @@ -9,9 +9,6 @@ class ApproveArticle < Task
9 if target.person? && requestor != target 9 if target.person? && requestor != target
10 self.errors.add(:requestor, _('You can not post articles to other users.')) 10 self.errors.add(:requestor, _('You can not post articles to other users.'))
11 end 11 end
12 - if target.organization? && !target.members.include?(requestor) && target.environment.portal_community != target  
13 - self.errors.add(:requestor, _('Only members can post articles on communities.'))  
14 - end  
15 end 12 end
16 end 13 end
17 14
test/unit/approve_article_test.rb
@@ -462,7 +462,7 @@ class ApproveArticleTest < ActiveSupport::TestCase @@ -462,7 +462,7 @@ class ApproveArticleTest < ActiveSupport::TestCase
462 assert t2.invalid?(:requestor) 462 assert t2.invalid?(:requestor)
463 end 463 end
464 464
465 - should 'allow only members to be requestors when target is a community' do 465 + should 'allow anyone to be requestors when target is a community' do
466 community = fast_create(Community) 466 community = fast_create(Community)
467 member = fast_create(Person) 467 member = fast_create(Person)
468 community.add_member(member) 468 community.add_member(member)
@@ -472,8 +472,7 @@ class ApproveArticleTest < ActiveSupport::TestCase @@ -472,8 +472,7 @@ class ApproveArticleTest < ActiveSupport::TestCase
472 t2 = ApproveArticle.new(:requestor => non_member, :target => community) 472 t2 = ApproveArticle.new(:requestor => non_member, :target => community)
473 473
474 assert t1.valid? 474 assert t1.valid?
475 - assert !t2.valid?  
476 - assert t2.invalid?(:requestor) 475 + assert t2.valid?
477 end 476 end
478 477
479 should 'allow any user to be requestor whe the target is the portal community' do 478 should 'allow any user to be requestor whe the target is the portal community' do