]> git.cworth.org Git - sup/commitdiff
remove load_entry_for_id call in DraftManager.discard
authorRich Lane <rlane@club.cc.cmu.edu>
Sat, 20 Jun 2009 20:50:01 +0000 (13:50 -0700)
committerWilliam Morgan <wmorgan-sup@masanjin.net>
Wed, 24 Jun 2009 13:44:48 +0000 (09:44 -0400)
lib/sup/draft.rb

index 912773999cbbdee52a39f01e73f72dd1d425091c..1233945742d94dc2e55aab60a1c286ed2a23d0c4 100644 (file)
@@ -31,14 +31,9 @@ class DraftManager
   end
 
   def discard m
-    docid, entry = Index.load_entry_for_id m.id
-    unless entry
-      Redwood::log "can't find entry for draft: #{m.id.inspect}. You probably already discarded it."
-      return
-    end
-    raise ArgumentError, "not a draft: source id #{entry[:source_id].inspect}, should be #{DraftManager.source_id.inspect} for #{m.id.inspect} / docno #{docid}" unless entry[:source_id].to_i == DraftManager.source_id
+    raise ArgumentError, "not a draft: source id #{m.source.id.inspect}, should be #{DraftManager.source_id.inspect} for #{m.id.inspect}" unless m.source.id.to_i == DraftManager.source_id
     Index.delete m.id
-    File.delete @source.fn_for_offset(entry[:source_info])
+    File.delete @source.fn_for_offset(m.source_info)
     UpdateManager.relay self, :single_message_deleted, m
   end
 end