From f7d1038860cefb708fe735ee9e45384d52af1298 Mon Sep 17 00:00:00 2001 From: Toks Date: Fri, 9 Aug 2013 18:42:52 -0400 Subject: [PATCH] fixes #1927 --- app/models/post.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/app/models/post.rb b/app/models/post.rb index 78c775e09..8b86c0b57 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -973,9 +973,22 @@ class Post < ActiveRecord::Base end def copy_notes_to(other_post) + return if notes.active.length == 0 + notes.active.each do |note| note.copy_to(other_post) end + + dummy = Note.new + if notes.active.length == 1 + dummy.body = "Copied 1 note from post ##{id}." + else + dummy.body = "Copied #{notes.active.length} notes from post ##{id}." + end + dummy.is_active = false + dummy.post_id = other_post.id + dummy.x = dummy.y = dummy.width = dummy.height = 0 + dummy.save end end