diff --git a/briar_wrapper/models/contacts.py b/briar_wrapper/models/contacts.py index a1468851cbc6bfa06de5ba9a6036f63e9913f3fb..adcd584c1f8d44d2e7dd33630b7515b73d22908e 100644 --- a/briar_wrapper/models/contacts.py +++ b/briar_wrapper/models/contacts.py @@ -2,6 +2,7 @@ # SPDX-License-Identifier: AGPL-3.0-only # License-Filename: LICENSE.md +from operator import itemgetter from urllib.parse import urljoin from requests import get as _get @@ -24,7 +25,10 @@ class Contacts(Model): def get(self): url = urljoin(BASE_HTTP_URL, self.API_ENDPOINT) request = _get(url, headers=self._headers) - return request.json() + contacts = request.json() + contacts.sort(key=itemgetter("lastChatActivity"), + reverse=True) + return contacts def get_link(self): url = urljoin(BASE_HTTP_URL, self.API_ENDPOINT + "add/" + "link/")