pinax / pinax-messages

a Django app for allowing users of your site to send messages to each other
MIT License
202 stars 58 forks source link

The Thread.objects.inbox methods returns only the thread with two or more users #1

Closed mattions closed 12 years ago

mattions commented 12 years ago

I've just noticed that the Thread.objects.inbox returns only the thread with two or more users.

I'm wondering if this is for design (and an easy way to exclude the sent thread and not answered, with the one with a conversation.)

consider this code:

In [66]: Thread.objects.inbox(2)
Out[66]: [<Thread: Thread object>, <Thread: Thread object>]

and this result

In [65]: Thread.objects.filter(userthread__user=2)
Out[65]: [<Thread: Thread object>, <Thread: Thread object>, <Thread: Thread object>, <Thread: Thread object>, <Thread: Thread object>, <Thread: Thread object>]

All the other threads have been created with user.pk==2, and there is no answer to them.

mattions commented 12 years ago

read the code, I saw the unread and deleted filter are applied, which cause the difference