Commit 994858779af504c197ddd51eee76fbbaf3124c5c
1 parent
54e2f909
Exists in
master
and in
29 other branches
Fixing ApproveArticle rejection message
* Showing the name of the article * Returning message even without rejection explanation
Showing
2 changed files
with
11 additions
and
1 deletions
Show diff stats
app/models/approve_article.rb
@@ -116,10 +116,11 @@ class ApproveArticle < Task | @@ -116,10 +116,11 @@ class ApproveArticle < Task | ||
116 | end | 116 | end |
117 | 117 | ||
118 | def task_cancelled_message | 118 | def task_cancelled_message |
119 | - message = _('Your request for publishing the article "{article}" was rejected.') | 119 | + message = _('Your request for publishing the article "%{article}" was rejected.') % {:article => name} |
120 | if !reject_explanation.blank? | 120 | if !reject_explanation.blank? |
121 | message += " " + _("Here is the reject explanation left by the administrator who rejected your article: \n\n%{reject_explanation}") % {:reject_explanation => reject_explanation} | 121 | message += " " + _("Here is the reject explanation left by the administrator who rejected your article: \n\n%{reject_explanation}") % {:reject_explanation => reject_explanation} |
122 | end | 122 | end |
123 | + message | ||
123 | end | 124 | end |
124 | 125 | ||
125 | end | 126 | end |
test/unit/approve_article_test.rb
@@ -413,5 +413,14 @@ class ApproveArticleTest < ActiveSupport::TestCase | @@ -413,5 +413,14 @@ class ApproveArticleTest < ActiveSupport::TestCase | ||
413 | end | 413 | end |
414 | end | 414 | end |
415 | 415 | ||
416 | + should 'return reject message even without reject explanation' do | ||
417 | + task = ApproveArticle.new(:name => 'My Article') | ||
418 | + assert_not_nil task.task_cancelled_message | ||
419 | + end | ||
420 | + | ||
421 | + should 'show the name of the article in the reject message' do | ||
422 | + task = ApproveArticle.new(:name => 'My Article') | ||
423 | + assert_match /My Article/, task.task_cancelled_message | ||
424 | + end | ||
416 | 425 | ||
417 | end | 426 | end |