diff --git a/colab/super_archives/management/commands/import_emails.py b/colab/super_archives/management/commands/import_emails.py index 7c3acd4..3ee3a4b 100644 --- a/colab/super_archives/management/commands/import_emails.py +++ b/colab/super_archives/management/commands/import_emails.py @@ -295,3 +295,7 @@ class Command(BaseCommand, object): raise finally: os.remove(self.lock_file) + + for mlist in MailingList.objects.all(): + mlist.update_privacy() + mlist.save() \ No newline at end of file diff --git a/colab/super_archives/migrations/0002_mailinglist_is_private.py b/colab/super_archives/migrations/0002_mailinglist_is_private.py new file mode 100644 index 0000000..1d36896 --- /dev/null +++ b/colab/super_archives/migrations/0002_mailinglist_is_private.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('super_archives', '0001_initial'), + ] + + operations = [ + migrations.AddField( + model_name='mailinglist', + name='is_private', + field=models.BooleanField(default=False), + preserve_default=True, + ), + ] diff --git a/colab/super_archives/search_indexes.py b/colab/super_archives/search_indexes.py index f0165e9..1e328a9 100644 --- a/colab/super_archives/search_indexes.py +++ b/colab/super_archives/search_indexes.py @@ -85,10 +85,12 @@ class ThreadIndex(BaseIndex, indexes.Indexable): return u'thread' def index_queryset(self, using=None): - return self.get_model().objects.filter( - spam=False + elements = self.get_model().objects.filter( + spam=False, mailinglist__is_private=False ).exclude(subject_token='') + return elements + def get_boost(self, obj): boost = super(ThreadIndex, self).get_boost(obj) -- libgit2 0.21.2