Browse files

Pass comment approval status to the template

By passing the comment's approval setting to the __thanks_for_comment
template, the template can provide additional feedback such as "Your
comment is awaiting moderator approval", "Sorry, we threw your comment
away", or similar if the comment was not automatically approved.  For
example, __thanks_for_comment.liquid could look like the following:

  Thanks for the comment.
  {% unless approved %}It is awaiting moderation.{% endunless %}
  • Loading branch information...
1 parent bb6c3a3 commit 29e8c41bd7dcdb514c8eee87278cd36e9f97011b @davec davec committed with emk Feb 27, 2009
Showing with 2 additions and 1 deletion.
  1. +2 −1 app/controllers/mephisto_controller.rb
@@ -76,7 +76,8 @@ def dispatch_comments
def dispatch_comment
@skip_caching = true
- message = site.call_render(nil, :__thanks_for_comment, {}, nil, :layout => false) rescue "Thanks for the comment!"
+ approved = Comment.find_by_id(@dispatch_path.last).approved? rescue false
+ message = site.call_render(nil, :__thanks_for_comment, { 'approved' => approved }, nil, :layout => false) rescue "Thanks for the comment!"
show_article_with 'message' => message

0 comments on commit 29e8c41

Please sign in to comment.