From mboxrd@z Thu Jan 1 00:00:00 1970 From: ezyang@MIT.EDU (Edward Z. Yang) Date: Sat, 08 Aug 2009 02:07:22 -0400 Subject: [sup-talk] Odd bug with lazy-loaded messages In-Reply-To: <1249319474-sup-8322@masanjin.net> References: <1248716007-sup-5156@javelin> <1249319474-sup-8322@masanjin.net> Message-ID: <1249711570-sup-2277@javelin> Excerpts from William Morgan's message of Mon Aug 03 13:18:50 -0400 2009: > This is because we store a couple variants of the address in the index > (e.g. the email address to the left of the @), so that a search on any > of them will bring up the message. Without #load_from_source!, the > message is loaded from the index, so it reflects those fields. So it's > basically a hack at this point. You could further hack it by undoing > that transformation. Or we could add the original version of the fields > to the index in a separate, non-searchable field, incurring the > associated storage penalties. Great. I sprinkled a few extra load_from_source! calls and I think I made the weird behavior go away. It's kind of sketchy though. >From 6c539b9c0fb952b0cc10c121cb906b1aefd58c31 Mon Sep 17 00:00:00 2001 From: Edward Z. Yang Date: Mon, 8 Jun 2009 22:21:01 -0400 Subject: [PATCH 1/3] Remove message pre-loading; optimizes for the common case. There are some load_from_source! calls to flush away extra header info that we don't want displayed. We may need to add this in more/less places. Signed-off-by: Edward Z. Yang --- lib/sup/modes/thread-index-mode.rb | 1 - lib/sup/modes/thread-view-mode.rb | 2 ++ 2 files changed, 2 insertions(+), 1 deletions(-) diff --git a/lib/sup/modes/thread-index-mode.rb b/lib/sup/modes/thread-index-mode.rb index b671119..5e58072 100644 --- a/lib/sup/modes/thread-index-mode.rb +++ b/lib/sup/modes/thread-index-mode.rb @@ -105,7 +105,6 @@ EOS t.each_with_index do |(m, *o), i| next unless m BufferManager.say "#{message} (#{i}/#{num})", sid if t.size > 1 - m.load_from_source! end end mode = ThreadViewMode.new t, @hidden_labels, self diff --git a/lib/sup/modes/thread-view-mode.rb b/lib/sup/modes/thread-view-mode.rb index 737f6f1..94e3ed7 100644 --- a/lib/sup/modes/thread-view-mode.rb +++ b/lib/sup/modes/thread-view-mode.rb @@ -124,6 +124,7 @@ EOS end end + latest.load_from_source! @layout[latest].state = :open if @layout[latest].state == :closed @layout[earliest].state = :detailed if earliest.has_label?(:unread) || @thread.size == 1 @@ -555,6 +556,7 @@ private def initial_state_for m if m.has_label?(:starred) || m.has_label?(:unread) + m.load_from_source! :open else :closed -- 1.6.3.3