Rename Thread.last_message_timestamp to .last_active, and use datetimes

This commit is contained in:
Mads Marquart
2019-09-03 12:39:03 +02:00
parent ba088d45a7
commit 4b34a063e8
4 changed files with 19 additions and 22 deletions

View File

@@ -319,9 +319,7 @@ class Client:
else: # End of threads
break
last_thread_dt = _util.millis_to_datetime(
threads[-1].last_message_timestamp
)
last_thread_dt = threads[-1].last_active
# FB returns a sorted list of threads
if (before is not None and last_thread_dt > before) or (
@@ -332,9 +330,8 @@ class Client:
# Return only threads between before and after (if set)
if before is not None or after is not None:
for t in threads:
last_message_dt = _util.millis_to_datetime(t.last_message_timestamp)
if (before is not None and last_message_dt > before) or (
after is not None and last_message_dt < after
if (before is not None and t.last_active > before) or (
after is not None and t.last_active < after
):
threads.remove(t)