Exemple #1
0
 def on_email_deleted(self, email):
     from hyperkitty.tasks import rebuild_thread_cache_new_email
     # update or cleanup thread
     if self.emails.count() == 0:
         self.delete()
     else:
         if self.starting_email is None:
             self.find_starting_email()
             self.save(update_fields=["starting_email"])
         compute_thread_order_and_depth(self)
         self.date_active = self.emails.order_by("-date").first().date
         rebuild_thread_cache_new_email(self.id)
 def on_email_added(self, email):
     self.find_starting_email()
     self.date_active = email.date
     if self.starting_email is None:
         self.starting_email = email
     self.save()
     if not getattr(settings, "HYPERKITTY_BATCH_MODE", False):
         # Cache handling and thread positions will be handled at the end of
         # the import process.
         from hyperkitty.tasks import (compute_thread_positions,
                                       rebuild_thread_cache_new_email)
         rebuild_thread_cache_new_email(self.id)
         compute_thread_positions(self.id)
 def test_rebuild_thread_cache_new_email_no_thread(self):
     try:
         tasks.rebuild_thread_cache_new_email(42)
     except Thread.DoesNotExist:
         self.fail("No protection when the thread is deleted")