Increase security and reformat
This commit is contained in:
@@ -4,7 +4,6 @@ from urllib.parse import urlencode
|
||||
from django.shortcuts import render
|
||||
from django.urls import reverse
|
||||
from django.views import View
|
||||
from mixins.views import ObjectList, ObjectRead
|
||||
|
||||
from core.clients import transport
|
||||
from core.models import PersonIdentifier, PlatformChatLink
|
||||
@@ -13,6 +12,7 @@ from core.presence import latest_state_for_people
|
||||
from core.util import logs
|
||||
from core.views.compose import _compose_urls, _service_icon_class
|
||||
from core.views.manage.permissions import SuperUserRequiredMixin
|
||||
from mixins.views import ObjectList, ObjectRead
|
||||
|
||||
log = logs.get_logger("whatsapp_view")
|
||||
|
||||
@@ -293,7 +293,9 @@ class WhatsAppChatsList(WhatsAppContactsList):
|
||||
contact_index[key] = {"name": name, "jid": jid}
|
||||
|
||||
history_anchors = state.get("history_anchors") or {}
|
||||
for key, anchor in (history_anchors.items() if isinstance(history_anchors, dict) else []):
|
||||
for key, anchor in (
|
||||
history_anchors.items() if isinstance(history_anchors, dict) else []
|
||||
):
|
||||
identifier = str(key or "").strip()
|
||||
if not identifier:
|
||||
continue
|
||||
@@ -333,7 +335,11 @@ class WhatsAppChatsList(WhatsAppContactsList):
|
||||
f"{reverse('compose_contact_match')}?"
|
||||
f"{urlencode({'service': 'whatsapp', 'identifier': identifier})}"
|
||||
),
|
||||
"last_ts": int((anchor or {}).get("ts") or (anchor or {}).get("updated_at") or 0),
|
||||
"last_ts": int(
|
||||
(anchor or {}).get("ts")
|
||||
or (anchor or {}).get("updated_at")
|
||||
or 0
|
||||
),
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user