From 397e130f5ae691b6879e754a2f5b57e3f5680861 Mon Sep 17 00:00:00 2001 From: Toks Date: Sun, 20 Oct 2013 20:13:03 -0400 Subject: [PATCH] #1970: Fix bug for new uploads --- app/models/post.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/models/post.rb b/app/models/post.rb index a911bea5a..fc5946ec7 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -464,8 +464,9 @@ class Post < ActiveRecord::Base self.parent_id = nil when /^parent:(\d+)$/i - if $1.to_i != id && Post.exists?(["id = ?", $1.to_i]) && Post.find($1.to_i).parent_id != id + if $1.to_i != id && Post.exists?(["id = ?", $1.to_i]) self.parent_id = $1.to_i + remove_parent_loops end when /^rating:([qse])/i @@ -816,7 +817,7 @@ class Post < ActiveRecord::Base end def remove_parent_loops - if parent.present? && parent.parent_id == id + if parent.present? && parent.parent_id.present? && parent.parent_id == id parent.parent_id = nil parent.save end