diff --git a/seahub/api2/utils.py b/seahub/api2/utils.py index 2be64cc978..c0e8890328 100644 --- a/seahub/api2/utils.py +++ b/seahub/api2/utils.py @@ -197,8 +197,8 @@ def get_group_and_contacts(email): group_json.append(group) for contact in contacts: - msg = UserMessage.objects.get_messages_related_to_user( - contact).order_by('-timestamp')[:1] + msg = UserMessage.objects.get_messages_between_users( + contact, email).order_by('-timestamp')[:1] mtime = 0 if len(msg) >= 1: mtime = get_timestamp(msg[0].timestamp) diff --git a/seahub/api2/views.py b/seahub/api2/views.py index 11f18c79e2..3993610d80 100644 --- a/seahub/api2/views.py +++ b/seahub/api2/views.py @@ -2632,8 +2632,7 @@ class UserMsgsView(APIView): 'to_email' : to_email, 'next_page' : next_page, 'msgs' : [],}) - - if person_msgs.has_next(): + elif person_msgs.has_next(): next_page = person_msgs.next_page_number() msgs = []