Commit 263c7bd1273707d207e1c727d5030f421f483efc

Authored by Rodrigo Souto
1 parent 7bfd1203

Adding rejection-explantion to approve-article task

(ActionItem2020)
app/models/approve_article.rb
... ... @@ -77,6 +77,10 @@ class ApproveArticle < Task
77 77 true
78 78 end
79 79  
  80 + def reject_details
  81 + true
  82 + end
  83 +
80 84 def default_decision
81 85 if article
82 86 'skip'
... ... @@ -107,4 +111,11 @@ class ApproveArticle < Task
107 111 end
108 112 end
109 113  
  114 + def task_cancelled_message
  115 + message = _('Your request for publishing the article "{article}" was rejected.')
  116 + if !reject_explanation.blank?
  117 + message += " " + _("Here is the reject explanation left by the administrator who rejected your article: \n\n%{reject_explanation}") % {:reject_explanation => reject_explanation}
  118 + end
  119 + end
  120 +
110 121 end
... ...
features/approve_article.feature
... ... @@ -5,9 +5,9 @@ Feature: approve article
5 5  
6 6 Background:
7 7 Given the following users
8   - | login | name |
9   - | joaosilva | Joao Silva |
10   - | mariasilva | Maria Silva |
  8 + | login | name | email |
  9 + | joaosilva | Joao Silva | joaosilva@example.com |
  10 + | mariasilva | Maria Silva | mariasilva@example.com |
11 11 And the following articles
12 12 | owner | name | body | homepage |
13 13 | mariasilva | Sample Article | This is an article | true |
... ... @@ -34,3 +34,20 @@ Feature: approve article
34 34 And I go to Sample Community's sitemap
35 35 And I follow "Sample Article"
36 36 Then I should see "This is an article edited"
  37 +
  38 + @selenium
  39 + Scenario: reject an article with explanation
  40 + Given I am logged in as "mariasilva"
  41 + And I go to Maria Silva's cms
  42 + And I follow "Sample Article"
  43 + And I follow "Spread" and wait
  44 + And I check "Sample Community"
  45 + And I press "Spread this"
  46 + And I am logged in as "joaosilva"
  47 + And I go to Sample Community's control panel
  48 + And I follow "Process requests" and wait
  49 + And I choose "Reject"
  50 + And I fill in "Rejection explanation" with "This is not an appropriate article for this community."
  51 + And I press "Apply!"
  52 + When I go to Sample Community's sitemap
  53 + Then I should not see "Sample Article"
... ...