From c0780f3af2844fc59f10edecb888d1a6e3b4c053 Mon Sep 17 00:00:00 2001 From: Jonne Hass Date: Wed, 7 Sep 2011 15:55:48 +0200 Subject: [PATCH] only touch post on comment creation, fix #1911 --- app/models/comment.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/models/comment.rb b/app/models/comment.rb index 65d4a3d6f..694a6d935 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -23,19 +23,26 @@ class Comment < ActiveRecord::Base xml_attr :text xml_attr :diaspora_handle - belongs_to :post, :touch => true + belongs_to :post belongs_to :author, :class_name => 'Person' validates_presence_of :text, :post validates_length_of :text, :maximum => 2500 serialize :youtube_titles, Hash + before_save do self.text.strip! unless self.text.nil? end + + after_save do + self.post.touch + end + def diaspora_handle self.author.diaspora_handle end + def diaspora_handle= nh self.author = Webfinger.new(nh).fetch end