Skip to content
Snippets Groups Projects
Commit e17df64f authored by Nico's avatar Nico
Browse files

Sort contact list by chat activity

parent ba0d2c23
No related branches found
No related tags found
No related merge requests found
......@@ -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/")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment