Example #1
0
def get_user_threads(threads, lists_for_user, key):
    visible_threads = []
    listnames_for_user = mailman.extract_listname_from_list(lists_for_user)
    for t in threads:
        if not t.mailinglist.is_private or \
           t.mailinglist.name in listnames_for_user:
            visible_threads.append(key(t))

    return visible_threads
def get_user_threads(threads, lists_for_user, key):
    visible_threads = []
    listnames_for_user = mailman.extract_listname_from_list(lists_for_user)
    for t in threads:
        if not t.mailinglist.is_private or \
           t.mailinglist.name in listnames_for_user:
            visible_threads.append(key(t))

    return visible_threads
Example #3
0
def get_visible_threads_queryset(logged_user):
    queryset = Thread.objects
    listnames_for_user = []
    if logged_user.is_authenticated():
        lists_for_user = mailman.get_user_mailinglists(logged_user)
        listnames_for_user = mailman.extract_listname_from_list(lists_for_user)

    user_lists = Q(mailinglist__name__in=listnames_for_user)
    public_lists = Q(mailinglist__is_private=False)
    queryset = Thread.objects.filter(user_lists | public_lists)

    return queryset
def get_visible_threads_queryset(logged_user):
    queryset = Thread.objects
    listnames_for_user = []
    if logged_user.is_authenticated():
        lists_for_user = mailman.get_user_mailinglists(logged_user)
        listnames_for_user = mailman.extract_listname_from_list(lists_for_user)

    user_lists = Q(mailinglist__name__in=listnames_for_user)
    public_lists = Q(mailinglist__is_private=False)
    queryset = Thread.objects.filter(user_lists | public_lists)

    return queryset