Refactoring empty filtering

This commit is contained in:
KnugiHK
2024-07-13 14:12:21 +08:00
parent 09e5e1a756
commit 80bdc4414a
3 changed files with 18 additions and 15 deletions

View File

@@ -11,7 +11,7 @@ from markupsafe import escape as htmle
from hashlib import sha256
from base64 import b64decode, b64encode
from Whatsapp_Chat_Exporter.data_model import ChatStore, Message
from Whatsapp_Chat_Exporter.utility import MAX_SIZE, ROW_SIZE, DbType, determine_metadata, JidType
from Whatsapp_Chat_Exporter.utility import MAX_SIZE, ROW_SIZE, DbType, determine_metadata, JidType, chat_is_empty
from Whatsapp_Chat_Exporter.utility import rendering, Crypt, Device, get_file_name, setup_template
from Whatsapp_Chat_Exporter.utility import brute_force_offset, CRYPT14_OFFSETS, get_status_location
from Whatsapp_Chat_Exporter.utility import get_chat_condition, slugify
@@ -749,7 +749,8 @@ def create_html(
embedded=False,
offline_static=False,
maximum_size=None,
no_avatar=False
no_avatar=False,
filter_empty=True
):
template = setup_template(template, no_avatar)
@@ -763,7 +764,7 @@ def create_html(
for current, contact in enumerate(data):
chat = data[contact]
if len(chat.messages) == 0:
if filter_empty and chat_is_empty(chat):
continue
safe_file_name, name = get_file_name(contact, chat)