def multi_toggle_spam threads
    undos = threads.map { |t| actually_toggle_spammed t }
    threads.each { |t| HookManager.run("mark-as-spam", :thread => t) }
    UndoManager.register "marking/unmarking  #{threads.size.pluralize 'thread'} as spam",
                         undos, lambda { regen_text }, lambda { threads.each { |t| Index.save_thread t } }
    regen_text
    threads.each { |t| Index.save_thread t }
  end
def multi_toggle_spam threads
    undos = threads.map { |t| actually_toggle_spammed t }
    threads.each { |t| HookManager.run("mark-as-spam", :thread => t) }
    UndoManager.register "marking/unmarking  #{threads.size.pluralize 'thread'} as spam",
                         undos, lambda { regen_text }, lambda { threads.each { |t| Index.save_thread t } }
    regen_text
    threads.each { |t| Index.save_thread t }
  end
both spam and deleted have the curious characteristic that you
 always want to hide the thread after either applying or removing
 that label. in all thread-index-views except for
 label-search-results-mode, when you mark a message as spam or
 deleted, you want it to disappear immediately; in LSRM, you only
 see deleted or spam emails, and when you undelete or unspam them
 you also want them to disappear immediately.