Permalink
Browse files

small fix and improvement in comment's notification

  • Loading branch information...
1 parent 7de59ed commit dffb90bedbee3d8d8b088287f9dcb647aff24c6d @molpe molpe committed Nov 2, 2009
Showing with 5 additions and 4 deletions.
  1. +1 −0 CHANGELOG.md
  2. +2 −2 app/controllers/comments_controller.rb
  3. +2 −2 lib/comment.rb
View
@@ -12,6 +12,7 @@ Edge
* using acts_as_rateable and acts_as_shareable as plugins, which fixes problem with timestamps while installing
* using acts_as_taggable_on instead of acts_as_taggable_on_steroids_
* comments can be posted to twitter (kudos to boonious)
+* for comments notification, commentable must respond to user or owner (till now must respond to owner)
0.5.4
----
@@ -4,8 +4,8 @@ def create
commentable = Comment.find_commentable params[:comment][:commentable_type], params[:comment][:commentable_id]
@comment = commentable.comments.new(params[:comment])
- @comment.user_id = current_user.id if !current_user.nil?
- @comment.approved = !commentable.respond_to?("moderated") || !commentable.moderated || commentable.owner == current_user
+ @comment.user_id = current_user.id unless current_user.nil?
+ @comment.approved = !commentable.respond_to?("moderated") || !commentable.moderated || commentable.commentable_owner == current_user
@comment.spam = Cerberus.check_spam(@comment, request)
View
@@ -29,10 +29,10 @@ def author_email
end
end
def commentable_owner
- commentable.owner if commentable
+ commentable.respond_to?("owner") ? commentable.owner : commentable.user
end
def commentable_owner_email
- commentable.owner.email if commentable && commentable.owner
+ commentable_owner.email if commentable && commentable_owner
end
def commentable_title
commentable.title_for_comment

0 comments on commit dffb90b

Please sign in to comment.