mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-08-05 02:45:28 +00:00
fix(email): normalize folder cache query defaults
This commit is contained in:
parent
7a900c976a
commit
aa954ba823
1 changed files with 5 additions and 1 deletions
|
|
@ -4086,6 +4086,10 @@ def setup_email_routes():
|
|||
"""List IMAP folders."""
|
||||
if _fixture_email_enabled():
|
||||
return {"folders": ["INBOX", "Archive", "Sent"], "sync": {"source": "fixture"}}
|
||||
try:
|
||||
cached_only_enabled = bool(int(cached_only or 0))
|
||||
except (TypeError, ValueError):
|
||||
cached_only_enabled = False
|
||||
cached = _folder_cache_get(account_id, owner)
|
||||
if cached is not None:
|
||||
payload = dict(cached)
|
||||
|
|
@ -4093,7 +4097,7 @@ def setup_email_routes():
|
|||
sync_meta["source"] = "folder_cache"
|
||||
payload["sync"] = sync_meta
|
||||
return payload
|
||||
if cached_only:
|
||||
if cached_only_enabled:
|
||||
stale = _folder_cache_get_stale(account_id, owner)
|
||||
if stale:
|
||||
payload = dict(stale)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue