示例#1
0
    def test_unread_counter_new_thread2(self):
        thread = self.create_thread_for_user(self.sender, self.recipient)
        thread.mark_as_seen(self.recipient)
        counter = get_unread_inbox_counter(self.recipient)
        self.assertEqual(counter.count, 0)

        counter = get_unread_inbox_counter(self.sender)
        self.assertEqual(counter.count, 0)
示例#2
0
    def test_unread_counter_new_thread2(self):
        thread = self.create_thread_for_user(self.sender, self.recipient)
        thread.mark_as_seen(self.recipient)
        counter = get_unread_inbox_counter(self.recipient)
        self.assertEqual(counter.count, 0)

        counter = get_unread_inbox_counter(self.sender)
        self.assertEqual(counter.count, 0)
示例#3
0
    def test_unread_counter_new_thread1(self):
        counter = get_unread_inbox_counter(self.recipient)
        self.assertEqual(counter.count, 0)

        thread = self.create_thread_for_user(self.sender, self.recipient)
        counter = get_unread_inbox_counter(self.recipient)
        self.assertEqual(counter.count, 1)

        counter = get_unread_inbox_counter(self.sender)
        self.assertEqual(counter.count, 0)
示例#4
0
    def test_unread_counter_new_thread1(self):
        counter = get_unread_inbox_counter(self.recipient)
        self.assertEqual(counter.count, 0)

        thread = self.create_thread_for_user(self.sender, self.recipient)
        counter = get_unread_inbox_counter(self.recipient)
        self.assertEqual(counter.count, 1)

        counter = get_unread_inbox_counter(self.sender)
        self.assertEqual(counter.count, 0)
示例#5
0
 def test_recalculate_unread_counter(self):
     thread = self.create_thread_for_user(self.sender, self.recipient)
     counter = get_unread_inbox_counter(self.recipient)
     counter.reset()
     self.assertEqual(counter.count, 0)
     counter.recalculate()
     self.assertEqual(counter.count, 1)
示例#6
0
 def test_recalculate_unread_counter(self):
     thread = self.create_thread_for_user(self.sender, self.recipient)
     counter = get_unread_inbox_counter(self.recipient)
     counter.reset()
     self.assertEqual(counter.count, 0)
     counter.recalculate()
     self.assertEqual(counter.count, 1)
示例#7
0
 def handle_noargs(self, *args, **kwargs):
     users = User.objects.all()
     count = users.count()
     message = 'Fixing inbox counts for the users'
     for user in ProgressBar(users.iterator(), count, message):
         counter = get_unread_inbox_counter(user)
         counter.recalculate()
         counter.save()
         transaction.commit()
 def handle_noargs(self, *args, **kwargs):
     users = User.objects.all()
     count = users.count()
     message = 'Fixing inbox counts for the users'
     for user in ProgressBar(users.iterator(), count, message):
         counter = get_unread_inbox_counter(user)
         counter.recalculate()
         counter.save()
         transaction.commit()
示例#9
0
def group_messaging_context(request):
    if request.user.is_authenticated():
        count_record = get_unread_inbox_counter(request.user)
        return {'group_messaging_unread_inbox_count': count_record.count}
    return {}